Automatically Load and Execute VBA Projects (Concept)

AutoCAD

 
Automatically Load and Execute VBA Projects
Concept Quick Reference
 
 
 

You can load VBA projects automatically each time you run AutoCAD.

As you build up a number of VBA projects, you can load them automatically each time you run AutoCAD. The macros they contain are immediately available. Additionally, the APPLOAD command provides a Startup Suite option that automatically loads the specified applications.

acvba.arx — Automatically Load VBA

You cannot load VBA until an AutoCAD VBA command is issued. If you want to load VBA automatically every time you start AutoCAD include the following line in the acad.rx file:

acvba.arx

You can automatically run a macro in the acad.dvb file by naming the macro AcadStartup. Any macro in your acad.dvb file called AcadStartup automatically executes when VBA loads.

acad.dvb — Automatically Load a VBA Project

The acad.dvb file is useful if you want to load a specific VBA project that contains macros you want each time you start AutoCAD. Each time you start a new AutoCAD drawing session, AutoCAD searches for the acad.dvb file and loads it.

If you want a macro in your acad.dvb file to run each time you start a new drawing or open an existing one, add the following code to your acaddoc.lsp file:

(defun S::STARTUP()
 (command "_-vbarun" "updatetitleblock")
)

The project name in the example is updatetitleblock.