WD2000: ActiveWindow.Visible Property Causes Word to Appear to Stop Responding (220419)
The information in this article applies to:
This article was previously published under Q220419 SYMPTOMS
When you manipulate the Visible property of the Visual Basic for Applications ActiveWindow property to hide a document, as in ActiveWindow.Visible = False, Word appears to stop responding when you close the document.
For example, the following procedure demonstrates this behavior:
Sub HideDoc()
Documents.Add ' Add new document.
ActiveWindow.Visible = False ' Hide document.
Selection.TypeText "This is a document." ' Insert text.
ActiveWindow.Visible = True ' Show document.
End Sub
After running the above procedure, if you perform the following steps:
- On the File menu, click Close.
- Click No to the Save Changes prompt.
You cannot perform any further actions in Word.
CAUSE
Word is in a state in which the toolbars have not been properly activated.
RESOLUTION
To work around the problem of Word appearing to stop responding, start another instance of Word. You can then perform further actions in Word.
To resolve the problem of setting the Visible property of the ActiveWindow, causing Word to appear to stop responding, use one of the following sample procedures as a substitute: Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements.
Sub HideDoc1()
Dim oDoc As Document
Set oDoc = Documents.Add ' Create new document.
With oDoc.ActiveWindow
.Visible = False ' Hide the document.
.Selection.TypeText "This is a document." ' Insert text.
.Visible = True ' Show the document.
End With
End Sub
-or-
Sub HideDoc2()
Documents.Add ' Create new document.
With ActiveWindow
.Visible = False ' Hide the document.
.Selection.TypeText "This is a document." ' Insert text.
.Visible = True ' Show the document.
End With
End Sub
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 6/17/2005 |
---|
Keywords: | kbbug kbpending KB220419 |
---|
|