About Referencing Other VBA Projects (VBA/ActiveX)

Referencing one VBA project from another allows developers to share code more easily.

Developers can create libraries of commonly used macros and then reference the library when needed. This keeps the shared code centrally located and supported, while allowing a large number of developers to utilize the code.

Once another project has been successfully referenced, you will notice a new folder in the Projects window of the VBA IDE. This new folder is titled References and contains the name of the project referenced.

Once you have referenced a project, you can use any public code or form component in that project.

When a project that references another project is loaded into AutoCAD, the referenced project is automatically loaded into AutoCAD as well. The referenced project cannot be closed until all projects that reference it are closed first.

You cannot make circular references. That is, you cannot reference a project that contains a reference back to the first project. If you accidentally create a circular reference, you will be notified by VBA.

Project referencing is a standard feature of Microsoft VBA. There is no additional work in AutoCAD to extend this functionality. You can find more information on referencing projects in the Microsoft VBA Help. You can open the Microsoft VBA Help from the Help menu in the VBA IDE.

Note: You cannot reference embedded projects or VBA projects from other applications.