Reference the ActiveX Object Library of Other Applications

AutoCAD ActiveX

 
Reference the ActiveX Object Library of Other Applications
 
 
 

To write code that accesses another application, you must instruct VBA to make the objects in the other application available to you. You do this by setting a reference in the other application's object library. This is a file on your computer where all the objects, methods, properties, constants, and events for that application are defined.

You make a reference to an object library through the VBA IDE. In the VBA IDE, under the Tools menu, there is a menu option called References. This menu option will bring up a dialog box that lists all of the object libraries VBA finds on your system. To make a reference to a library, simply select the library from the list. Libraries with check boxes that are selected are already referenced in the current project. For example, to add the Microsoft Excel object library, select the Microsoft Excel object library entry in the list.

Once you have created a reference to another application's object library, you can use the VBA Object Browser to view a list of the application's objects.

NoteYou must set the reference for each VBA project that will use this Object Model. Setting the reference for one project won't automatically set it for another project. This is for performance reasons.

To make a reference to another application's object library

  1. In the VBA IDE, open the Tools menu and select the References menu option.
  2. Find and select the entry in the list of Available References for the application you want to access.
  3. Select OK to close the dialog box with your changes.