|
|
You load a VBA project with the VBALOAD command. Once loaded, its modules and macros are available in the Macros dialog box.
Although Microsoft applications store VBA projects, macros, and programs inside a specific document, AutoCAD uses a separate file with the .dvb extension. In this way, VBA interfaces with AutoCAD in much the same way that AutoLISP and ObjectARX do. Because VBA projects are stored in a separate file, a VBA project can open and close different AutoCAD drawings during an AutoCAD session.
You load a VBA project with the VBALOAD command. Once loaded, its modules and macros are available in the Macros dialog box. To run the VBA module you use the VBARUN command. If no VBA project is loaded, the options are unavailable. Procedures listed in the Macro Name box use the following syntax:
module.macro
In the Macros dialog box you choose the Macro Scope and select from the listed modules.
Use the Command Prompt to Run a VBA Macro
The -VBARUN command can be used to run a macro from the command prompt. This allows you to run VBA macros from the command prompt, scripts, and other AutoCAD programming environments. The only argument for the command is the module name using the module.macro syntax. The syntax looks like this:
-vbarun <module.macro>
Because macros with the same name can be duplicated in modules, the module.macro syntax differentiates the macro and allows for unique selection.