vbaautocad

Load VBA script in AutoCAD


I'm trying to make AutoCAD run a VBA script, but I can't seem to load the script properly.

Sub hello()
MsgBox ("Hello World")
End Sub

This runs perfectly when I execute the script.

I save the script as hello.dvb

Now, when I close the drawing and reopen it, my VBA script is gone from the editor.

Trying to reload it, using the command VBALOAD and loading hello.dvb into the drawing should allow me to run the script again, but looking in the VBA editor, my script has not been loaded.

Am I doing something wrong here?


Solution

  • I finally figured it out. It was simply because the directory was not added to Trusted Locations...

    One would think AutoCAD would tell you that prompting the error, but unfortunately they'd rather keep you guessing for solutions.