Microsoft KB Archive/275966

= WD2000: Run Time Error 4605 Accessing PageSetup Object After You Insert Table in Frame =

Article ID: 275966

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Word 2000 Standard Edition

-



This article was previously published under Q275966



SYMPTOMS
In Microsoft Word 2000, when you run a Microsoft Visual Basic for Applications macro that accesses the PageSetup object from the Document object or the Section object, you receive the following error message:

Run time error '4605'. This command is not available.



CAUSE
This problem can occur if all of the following conditions are true:  Your document contains a frame (not to be confused with an HTML frame or a frame page).

-and- The frame contains a table.

-and- The frame is anchored to the first paragraph in the document.

-and-  You run a Visual Basic for Applications macro from Word, accessing the PageSetup object from the Document object or the Section object, as in the following example: Public Sub TestPgSetup

MsgBox ActiveDocument.PageSetup.Orientation MsgBox ActiveDocument.Sections(1).PageSetup.Orientation

End Sub 

NOTE: You do not receive this error message if your frame does not contain a table, if you have a table that is not inside of the frame, or if the frame is anchored to anything other than the first paragraph in the document.



WORKAROUND
To work around this issue, do one of the following:
 * Position the frame so that it is no longer anchored to the first paragraph in the document by dragging it to another location in the document. (The frame is always anchored to the closest paragraph and appears on the same page as the paragraph that it's anchored to.)

-or-
 * Use a text box instead of a frame, and then insert your table into the text 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 corrected in Microsoft Word 2002.



MORE INFORMATION
To insert a frame into your document, follow these steps:
 * 1) Press ALT+F8 to switch to the Macros window.
 * 2) Type InsertFrame and then click Run.
 * 3) Click and drag the mouse in the document to create the frame.

<div class="references_section">