Symptoms
You run a Visual Basic application that uses the CreateObject function tostart a hidden instance of Microsoft Word. The application is idle, but itstill maintains a reference to Word. Next, you manually start an instanceof Word. A separate instance of Word should open, but the same instancethat was created by the Visual Basic application is made active instead. Ifyou close Word and continue to work in the Visual Basic application, one of the following errors occurs when the application tries to use Word objectsbecause Word is no longer running:
Run-time error ‘462′:
The remote server machine does not exist or is unavailable
-or-
Run-time error ‘-2147023174 (800706ba)’:
Automation errorThis automation error translates to “The RPC server is unavailable.”
Resolution
Use one of the following to work around this problem:Before you create your Word object, first create a temporary Wordobject. After you create your object, close the temporary object. Thiscauses Word to act properly when you control it through Automation (thatis, if a user interactively starts Word, a new instance of Word isopened for the user). The automation instance remains hidden andseparate. See the Steps to Reproduce Behavior section for an example ofthis workaround.Make the Word object visible immediately after using the CreateObjectfunction. This workaround is only for Microsoft Word 97. For example:
Set wrdApp = CreateObject(“Word.Application”)wrdApp.Visible = True