An AutoCAD® VBA project is a collection of code modules, class modules, and forms that work together to perform a given function. Projects can be stored within an AutoCAD drawing, or as a separate file.
Embedded projects are stored within an AutoCAD drawing. These projects are automatically loaded whenever the drawing in which they are contained is opened in AutoCAD, making the distribution of projects very convenient. Embedded projects are limited and not able to open or close AutoCAD drawings because they function only within the document where they reside. Users of embedded projects are no longer required to find and load project files before they run a program. A time log that is triggered when the drawing is opened is an example of a project embedded in a drawing. With this macro users can log in and record the length of time they worked on the drawing. The user does not have to remember to load the project before opening the drawing; it simply is done automatically.
Global projects are stored in separate files and are more versatile because they can work in, open, and close any AutoCAD drawing, but are not automatically loaded when a drawing is opened. Users must know which project file contains the macro they need and then load that project file before they can run the macro. However, global projects are easier to share with other users, and they make excellent libraries for common macros. An example of a project you may store in a project file is a macro that collects a bill of materials from many drawings. This macro can be run by an administrator at the end of a work cycle and can collect information from many drawings.
At any given time, users can have both embedded and global projects loaded into their AutoCAD session.
AutoCAD VBA projects are not binary compatible with standalone Visual Basic 6 projects. However, the forms, modules, and classes can be exchanged between projects using the IMPORT and EXPORT VBA commands in the VBA IDE. For more information about the VBA IDE, see Edit Your Projects with the VBA IDE.
The use of Visual Studio .NET to drive and customize AutoCAD through COM Automation is supported.