getActiveXObject Function

Applies to TestComplete 15.64, last modified on June 12, 2024


In JavaScript, use the getActiveXObject function to get a reference to an OLE object by its name and the name of the machine where it is running. To specify the OLE server running on a local machine, do not specify the MachineName parameter.


getActiveXObject(OleObjectMachineName) Parameters
OleObject [in] Required String
MachineName [in] Optional String
Result     Object  



ProgID or CLSID of the OLE server you want to access. For example, "Word.Application" or "{000209FF-0000-0000-C000-000000000046}".


Specifies the name of the machine where the specified OLE server is running. To get the OLE server running on a local machine, leave the value of this parameter empty.


An object that represents the specified OLE server.


  • If, in your code, you have many (more than several hundred) calls to properties and methods of the received object, you may experience performance issues. In this case, we recommend that you do not call properties and methods of the object directly. Use the $get, $set and $call methods for this purpose. This will allow the script to run faster and will improve the performance significantly.

    However, if you have only a few calls to object properties and methods, and you do not face any performance issues, you can keep the usual object-name.method-name syntax. This way your code will be easier to read and maintain.

  • You cannot use TestComplete as a client application for in-process OLE objects, the bitness of which is different than the bitness of TestComplete.


The code below launches Excel and makes the application visible:


// Launch Excel
var Excel = getActiveXObject("Excel.Application");
// Make it visible
Excel.Visible = true;

See Also

OleObject Property
GetRemoteOLEObject Method

Highlight search results