PDA

View Full Version : Making VBA programs run by Hot Keys or menus



muck
15th Jun 2010, 06:06 pm
Is it possable to make a VBA Program start running using a menu pick or a hot
key. What is the easyest way to make a VBA program pop up in AutoCAD 2010
Thank you,

BIGAL
16th Jun 2010, 03:30 am
Here is a code example just put it in your autoload file

(defun C:vbadrn ()
(vl-vbaload "S:/AutoDESK/VBA/vbadrains.dvb")
(vl-vbarun "pitscheduleupdate")
)

you can either type vbadrn or assign it to a menu ^c^cvbadrn or again in the menu ^c^c(vl-vbaload S:/AutoDESK/VBA/vbadrains.dvb") (vl-vbarun "pitscheduleupdate")

muck
16th Jun 2010, 11:55 am
What autoload file should this routine go into. Acad.lsp ?
Should a make a new autoload File?

Thank you,

muck
22nd Jun 2010, 05:10 pm
what is (vl-vbarun "pitscheduleupdate") all about? Where did pitscheduleupdate
come form?

BIGAL
23rd Jun 2010, 03:42 am
I guess by your question that your running a VBA that some else has written, to answer though the question there is two steps.

1 Load a VBA program it can contain many different routines within it. "VBDRAINS.dvb"

2 Run a particular sub routine within the VBA program "pitschedule"

If your VBA is already loaded as part of your statrtup proceedure then you only need step2 to run.