BUG: DefaultTab Property of Word's PageSetup Dialog Box Doesn't Set Layout Tab (309351)
The information in this article applies to:
This article was previously published under Q309351 SYMPTOMS
Automation code in Word to set the DefaultTab property for the PageSetup dialog box object to the Layout tab does not appear to work, or selects the wrong tab when the dialog box is shown.
For example, the following Visual Basic for Applications (VBA) code displays the PageSetup dialog box in Word 2002, but the Layout tab is not selected:
Sub Test()
Dialogs(wdDialogFilePageSetup).DefaultTab = wdDialogFilePageSetupTabLayout
Dialogs(wdDialogFilePageSetup).Show
End Sub
The same code runs as expected in Word 97 and Word 2000.
CAUSE
If you release the object and reacquire it (as in the code in the "Symptoms" section), the value for the tab setting is persisted and reloaded when the object is reacquired. In Word 2002, the PageSetup dialog box combines the Paper Size and Paper Source tabs into a single tab called Paper. Because of this change, the Layout tab is the third tab instead of the fourth tab in the dialog box. The DefaultTab property attempts to switch the dialog box to the fourth tab, which is the wrong tab.
In Word clients that have an East Asian language installed, the dialog box has a fourth tab named Document Grid, and the code selects this tab by mistake. For clients without such a language installed, the first tab appears but draws incorrectly.
RESOLUTION
To work around the problem, always set the DefaultTab property on the same object instance on which you call the Show method, as follows:
Sub Test()
With Dialogs(wdDialogFilePageSetup)
.DefaultTab = wdDialogFilePageSetupTabLayout
.Show
End With
End Sub
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 10/19/2001 |
---|
Keywords: | kbAutomation kbbug KB309351 |
---|
|