Jump to content

Autocad VBA Macro Button toolbar-how?


firavolla

Recommended Posts

Ok, I have a dvb project called SectGrinda.dvb inside a subfolder VBA_Macro of Autocad main dir.

I created the toolbar, the button, but I can't understand what i need to write inside the macro property of the button.

Now i have something like

^C^C_vbarun SectGrinda.dvb!Module1.Main

 

And with this, I first get the Macro dialogue of autocad, and then i have to hit run for my macro to execute. How solve it?

Link to comment
Share on other sites

Been there - done that!

 

Try changing _vbarun to -vbarun in your button macro

 

^C^C-vbarun SectGrinda.dvb!Module1.Main

this should run the function Main in module1

 

^C^C_vbarun SectGrinda.dvb!Module1.Main

this will show the Macros dialog box and expect you to then hit run

 

I think your best to load the file in your acad lisp startup then use your button to run the macro

 

look in the ACAD HELP

  • Run a VBA Macro from a Toolbar or Menu

-VBARUN filename.dvb!modulename.macroname

 

  • Automatically Load a VBA Project

Automatically Load a VBA Project (defun S::STARTUP()

(command "_VBALOAD" "myproj.dvb")

)

  • Automatically Run a VBA Macro

Automatically Run a VBA Macro(defun S::STARTUP() (command "_-vbarun" "drawline"))

Link to comment
Share on other sites

I had already looked in Acad help...But it doesn't seem to work. Using the - i get a Macro not found when clicking the button. Also, the macro is loaded at Acad startup using the load application option in the menu....Anymore ideas?

Link to comment
Share on other sites

Thank you guys for your help. It was actually because In the folder I had the project file, i also had a subfolder and in there a backup of the project but with the same name. It should have worked even so, but for some reason it didn't. I renamed that backup and now it works great!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...