About Establishing a Connection to an External Application with ActiveX (AutoLISP/ActiveX)

The ActiveX support functions can be used to establish a connection with other applications that utilize ActiveX.

Note: ActiveX support in AutoLISP is limited to Windows only.

For example, you can create a new instance of Microsoft Word or establish a connection to an existing instance that is already running on your computer.

The vlax-get-object function establishes a connection to a Microsoft Word application, and saves a pointer to the application in a variable named msw:

(setq msw (vlax-get-object "Word.Application"))

The vlax-create-object function creates a new instance of an application object. For example, if the return value from vlax-get-object is nil, indicating that the requested application does not exist, you can use vlax-create-object to start the application. The following call starts Microsoft Word and saves a pointer to the application in variable msw:

(setq msw (vlax-create-object "Word.Application"))

Alternatively, you can use vlax-get-or-create-object to access an application. This function attempts to connect to an existing instance of an application, and starts a new instance if it does not find one.

When you create a new instance of an application object, it does not appear until you make it visible. You make an object visible by setting its Visible property to TRUE. For example, the following call makes the Microsoft Word application visible:

(vla-put-visible msw :vlax-true)