WD2000: PRB: New Document Remains in Normal WindowState When Application is Minimized (235877)
The information in this article applies to:
- Microsoft Word 2000
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- Microsoft Visual Basic for Applications 5.0
- Microsoft Visual Basic for Applications 6.0
This article was previously published under Q235877 SYMPTOMS
When you automate Microsoft Word 2000 with code such as the following:
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
oApp.Documents.Add
oApp.WindowState = wdWindowStateMinimize
oApp.Documents.Add
the Word application is minimized but the new document window is in a normal window state. You expect that the new document window would also be minimized.
CAUSE
Word 2000 is now a Single Document Interface Application. So, whenever a new document is opened in Word 2000, it is opened in a separate window with the default WindowState. This occurs only if a document is already open in the running instance of Microsoft Word.
WORKAROUND
To work around this behavior, set the Visible property of Word to False instead of minimizing it. You do not see the new document when it is created. The code would now be:
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
oApp.Documents.Add
oApp.WindowState = wdWindowStateMinimize
oApp.Visible = False
oApp.Documents.Add
Alternately, depending on the application requirements, you can stay with the default Visible property instead of changing it to False later.
STATUSMicrosoft has confirmed that this is a problem in Microsoft Word 2000.
Modification Type: | Minor | Last Reviewed: | 8/23/2005 |
---|
Keywords: | kbAutomation kbbug kbpending KB235877 |
---|
|