Microsoft KB Archive/235877

= WD2000: PRB: New Document Remains in Normal WindowState When Application is Minimized =

Article ID: 235877

Article Last Modified on 8/23/2005

-

APPLIES TO


 * Microsoft Word 2000 Standard Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * 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.



STATUS
Microsoft has confirmed that this is a problem in Microsoft Word 2000.

