attachAutomationObject

attachAutomationObject(createIfNone: Boolean): IDispatch;

The attachAutomationObject method of the ActiveXAutomation class attempts to attach to an instance of the automation server that is already running. Use the createIfNone parameter to indicate that a new server should be started if an existing server cannot be found to which to attach.

For details about creating a new instance of the ActiveX automation object defined by the receiver, see "createAutomationObject", later in this section.

For an automation server to be attached to, it must have registered itself in the Windows Running Object Table (ROT). Some servers (for example, Microsoft Office applications) register only the first instance of each application. Any attachAutomationObject calls therefore always connect to the first instance of the application. For example, if you start four Excel applications, only the first application is recorded in the ROT. If multiple instances of an application are recorded in the ROT, the attachAutomationObject method always attaches to the first instance that is found.

As you can attach to a local server only, you cannot set the remoteServerName property and then call the attachAutomationObject method.