VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VBA and toolbar

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
184 Views, 3 Replies

VBA and toolbar

HI

In our mnu file we start an VBA routine this way

ID_ArmKontroll [_Button("Kontroll av valgte armeringsposter",
Armcheck.bmp, Armcheck.bmp)]^C^C^P(COWIbyggmenysti)(vl-vbaload (vba
"Armering"))(vl-vbarun "ArmeringKMacro.ArmeringUtilities")

But this will not start if enter is pushed as usually with last command.

Can anyone show me this is done.


bhl
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

bhl,

Try putting your VBA load/run commands inside of a "lisp wrapper" to make
them repeat.

Put lisp code similar to that below into your "acaddoc.lsp" file. Create the
"acaddoc.lsp" if you don't have one (see help)

Change your tool button to run the new lisp function "RunMyVBA" (as shown
below). The command should repeat (Acad 2004 or less) like any other native
command.

HTH,

Gary

(defun C:RunMyVBA ()

(vl-vbaload "C:\\YourDirectory\\YourVBAProgram.dvb")
(command "-vbarun" "YourMacroName")
(princ)

);end function "RunMyVBA"
Message 3 of 4
Anonymous
in reply to: Anonymous

in addition does your vba code use SendCommand anywhere? that
will end up being your last command..
"Gary McMaster" wrote in message
news:4883172@discussion.autodesk.com...
bhl,

Try putting your VBA load/run commands inside of a "lisp wrapper" to make
them repeat.

Put lisp code similar to that below into your "acaddoc.lsp" file. Create the
"acaddoc.lsp" if you don't have one (see help)

Change your tool button to run the new lisp function "RunMyVBA" (as shown
below). The command should repeat (Acad 2004 or less) like any other native
command.

HTH,

Gary

(defun C:RunMyVBA ()

(vl-vbaload "C:\\YourDirectory\\YourVBAProgram.dvb")
(command "-vbarun" "YourMacroName")
(princ)

);end function "RunMyVBA"
Message 4 of 4
Anonymous
in reply to: Anonymous

We use something like this


(defun C:RunMyVBA ()

(vl-vbarun "YourVBAProgram.dvb!vbaname.modulename.macroname")
(princ)

);end function "RunMyVBA"

This will autoload your macro as long as it is in your path and allow
you to just hit return to rerun the macro. the other way will work but
will only reissue the "-vbarun" command and not your program.

--
David Urban, P.E.
Project Engineer
Pape-Dawson Huffcut Engineers, Inc.
7800 Shoal Creek Blvd. Suite 253 East
Austin, TX 78757
ph. 512-454-8711
fax 512-459-8867
cell 512-415-1971
durban@pape-dawson.com

Paul Richardson wrote:

> in addition does your vba code use SendCommand anywhere? that
> will end up being your last command..
> "Gary McMaster" wrote in message
> news:4883172@discussion.autodesk.com...
> bhl,
>
> Try putting your VBA load/run commands inside of a "lisp wrapper" to make
> them repeat.
>
> Put lisp code similar to that below into your "acaddoc.lsp" file. Create the
> "acaddoc.lsp" if you don't have one (see help)
>
> Change your tool button to run the new lisp function "RunMyVBA" (as shown
> below). The command should repeat (Acad 2004 or less) like any other native
> command.
>
> HTH,
>
> Gary
>
> (defun C:RunMyVBA ()
>
> (vl-vbaload "C:\\YourDirectory\\YourVBAProgram.dvb")
> (command "-vbarun" "YourMacroName")
> (princ)
>
> );end function "RunMyVBA"


--
David Urban, P.E.
Project Engineer
Pape-Dawson Huffcut Engineers, Inc.
7800 Shoal Creek Blvd. Suite 253 East
Austin, TX 78757
ph. 512-454-8711
fax 512-459-8867
cell 512-415-1971
durban@pape-dawson.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost