Establishing a Connection to an Application
 
 
 

If an instance of Microsoft Word is already running on your PC, use vlax-get-object to establish a connection to the application. For example, the following function call 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 doesn't find one.

The application object 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)