Visual Basic Customization

Reply
*bhl
Message 1 of 4 (54 Views)

VBA and toolbar

54 Views, 3 Replies
06-22-2005 02:16 PM
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
*Gary McMaster
Message 2 of 4 (54 Views)

Re: VBA and toolbar

06-23-2005 07:36 AM in reply to: *bhl
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"
*Paul Richardson
Message 3 of 4 (54 Views)

Re: VBA and toolbar

06-24-2005 11:01 AM in reply to: *bhl
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
Message 4 of 4 (54 Views)

Re: VBA and toolbar

06-24-2005 12:26 PM in reply to: *bhl
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
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.