Automatically Run a VBA Macro

AutoCAD ActiveX

 
Automatically Run a VBA Macro
 
 
 

You can automatically run any macro in the acad.dvb file by calling it with the command line version of VBARUN from an AutoCAD startup facility like acad.lsp. For example, to automatically run the macro named drawline, first save the drawline macro in the acad.dvb file. Next, invoke notepad.exe and create (or append to) acad.lsp the following lines:

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

You can cause a macro to run automatically when VBA loads by naming the macro AcadStartup. Any macro in your acad.dvb file called AcadStartup will automatically get executed when VBA loads.