WD2000: "Run-Time Error 4605: This Command Is Not Available" When You Use PageSetup Property (248644)



The information in this article applies to:

  • Microsoft Word 2000

This article was previously published under Q248644

SYMPTOMS

In Word 2000 Visual Basic for Applications (VBA), when you use the PageSetup property to retrieve page setup information, you receive the following error message:
Run-time error 4605: This command is not available.

CAUSE

This problem occurs when all of the following conditions are true:
  • The section contains a frame.
  • The frame contains a table.
  • The frame is anchored to the first paragraph in the section.

RESOLUTION

To resolve this problem, obtain the latest service pack for Microsoft Office 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

276367 OFF2000: How to Obtain the Latest Office 2000 Service Pack


WORKAROUND

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site: For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: In your code, access the first paragraph in the section. Then retrieve the page setup information though the PageSetup object under the Paragraph.Range object. For example:

    Public Sub FrameTest()
      Dim sec As Section
       For Each sec In ActiveDocument.Sections
          MsgBox sec.Range.Paragraphs(1).Range.PageSetup.Orientation
       Next
    End Sub
				

This macro steps through all sections in the document and displays the page orientation (0 for Portrait or 1 for Landscape) in a message box.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft Office 2000 Service Pack 2.

MORE INFORMATION

Steps to Reproduce the Problem

  1. In Word 2000, open a new document.
  2. Press ENTER, so that there are two paragraphs in the document.
  3. On the Tools menu, point to Macro and then click Macros.
  4. In the Macro Name text box, type InsertFrame and then click Run. The insertion point now changes to a cross.
  5. Draw a frame.
  6. Drag the anchor of the frame to the first paragraph in the document.
  7. Insert a table into the frame.
  8. Press ALT+F11 to start the Visual Basic Editor.
  9. On the Insert menu, click Module to insert a new module.
  10. In the module, type the following VBA code:
        Public Sub FrameTest() 
          Dim sec As Section
           For Each sec In ActiveDocument.Sections
              MsgBox sec.PageSetup.Orientation
           Next
        End Sub 
    						
  11. Run the macro.

    Result: You receive the error message listed in the "Symptoms" section of this article.

Modification Type:MajorLast Reviewed:10/16/2002
Keywords:kbbug kbOffice2000preSP2Fix kbOffice2000sp2fix kbQFE KB248644