firavolla Posted June 23, 2010 Share Posted June 23, 2010 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? Quote Link to comment Share on other sites More sharing options...
dbroada Posted June 23, 2010 Share Posted June 23, 2010 I'm just guessing here as I'm not at work, have you tried a ; after the .Main to force an enter? Quote Link to comment Share on other sites More sharing options...
metal_pro Posted June 23, 2010 Share Posted June 23, 2010 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")) Quote Link to comment Share on other sites More sharing options...
firavolla Posted June 24, 2010 Author Share Posted June 24, 2010 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? Quote Link to comment Share on other sites More sharing options...
firavolla Posted June 24, 2010 Author Share Posted June 24, 2010 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.