Article ID: 189618 - Last Review: April 16, 2007 - Revision: 8.1 You may receive the "Run-time error '-2147023174' (800706ba)" error message or the "Run-time error '462'" when you run Visual Basic code that uses Automation to control Word
This article was previously published under Q189618 On This PageSYMPTOMS
When you run Microsoft Visual Basic code that uses Automation to control Microsoft Word, you may receive one of the following error messages: Error message 1
Run-time error '-2147023174' (800706ba) Automation error
Run-time error '462': The remote server machine does not exist or is
unavailable
CAUSE
Visual Basic has established a reference to Word due to a line of code
that calls a Word object, method, or property without qualifying it with
a Word object variable. Visual Basic does not release this reference
until you end the program. This errant reference interferes with automation
code when the code is run more than once.
RESOLUTION
Modify the code so that each call to a Word object, method, or property
is qualified with the appropriate object variable.
STATUS
This behavior is by design.
MORE INFORMATION
To automate Word, you establish an object variable that
usually refers to the Word Application or Document object. Other object
variables can then be set to refer to a Selection, a Range, or other
objects in the Word object model. When you write code to use a
Word object, method, or property, you should always precede the call with
the appropriate object variable. If you do not, Visual Basic uses a hidden
global variable reference which it sets to the currently running instance.
If Word is shutdown, or if the declared object variable is released, the
hidden global variable will now reference an invalid (destroyed)
object. When running the automation code again, calls to this hidden object
variable will fail with the aforementioned error.
The following steps illustrate how to reproduce this problem, and how to correct it. Steps to Reproduce Behavior
The sample code in the Help topic will be the Microsoft Word Visual Basic for Applications code. It will not show the object references that your Visual Basic code requires. You will need to add the qualifiers as appropriate. REFERENCES
For additional information, please see the following articles in the
Microsoft Knowledge Base:
178510
(http://support.microsoft.com/kb/178510/EN-US/
)
PRB: Excel Automation Method of Object '_Global'Failed
167223
(http://support.microsoft.com/kb/167223/EN-US/
)
Microsoft Office 97 Automation Help File Available
For additional information about the Automation of Office applications, click the article number below
to view the article in the Microsoft Knowledge Base:
222101
(http://support.microsoft.com/kb/222101/EN-US/
)
HOWTO: Find and Use Office Object Model Documentation
APPLIES TO
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations
|






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Back to the top
