WD2000: Document Not Displayed with CreateObject ("Word.Document") (209892)
The information in this article applies to:
This article was previously published under Q209892 SYMPTOMS
When you use the Visual Basic for Applications CreateObject function to create a "Word.Document" object, the document is not visible.
For example:
Sub CreateDocObject()
Dim oDoc As Document
Set oDoc = CreateObject(Class:="Word.Document")
End Sub
NOTE: If you are running this macro from within Word 97, the sample procedure above would create a visible document. If the sample macro were run from another application (for example, Microsoft Excel), the document would not be visible.
CAUSE
This behavior is by design. The CreateObject function should only create the server object, not the document. In Word 97, creation and visibility of a new document by using the CreateObject function is not the expected behavior while within Word 97.
Modification Type: | Major | Last Reviewed: | 6/17/2005 |
---|
Keywords: | kbnofix kbprb KB209892 |
---|
|