user macro as ToolbarItem

user macro as ToolbarItem

Anonymous
Not applicable
300 Views
5 Replies
Message 1 of 6

user macro as ToolbarItem

Anonymous
Not applicable
Public Sub add_tlbButton()
Dim tbb As AutoCAD.AcadToolbarItem
Set tbb = Application.MenuGroups("ACAD").Toolbars("Standard
Toolbar").AddToolbarButton(0, "bimbo", "bimbo!!!", Chr(3) & Chr(3) & Chr(95)
& "open" & Chr(32)) 'this version works
Set tbb = Nothing
End Sub

Public Sub remove_tlbButton()
Application.MenuGroups("ACAD").Toolbars("Standard
Toolbar").Item("bimbo").Delete
End Sub


so, this version of add_tlbButton works but it only works for intrinsic
functions like _open, when i try to place my_function_name as the macro name
it errs out with 'unknown command...'

?
0 Likes
301 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
I placed a call to a custom lisp routine in place of "open" and it worked
fine.

"flekso" wrote in message
news:5B6DCEA5D01AC82EB8AECDA44C07D44E@in.WebX.maYIadrTaRb...
> Public Sub add_tlbButton()
> Dim tbb As AutoCAD.AcadToolbarItem
> Set tbb = Application.MenuGroups("ACAD").Toolbars("Standard
> Toolbar").AddToolbarButton(0, "bimbo", "bimbo!!!", Chr(3) & Chr(3) &
Chr(95)
> & "open" & Chr(32)) 'this version works
> Set tbb = Nothing
> End Sub
>
> Public Sub remove_tlbButton()
> Application.MenuGroups("ACAD").Toolbars("Standard
> Toolbar").Item("bimbo").Delete
> End Sub
>
>
> so, this version of add_tlbButton works but it only works for intrinsic
> functions like _open, when i try to place my_function_name as the macro
name
> it errs out with 'unknown command...'
>
> ?
>
>
0 Likes
Message 3 of 6

Anonymous
Not applicable
you need to use the _vbarun command, then specifiy the macro name like module1.myMacro, or the path to the macro like:
C:\ProjectsX\$VBER1\$VBmicroLandscape\VBAconversions\Editing\LayerStandardEnforcer.dvb!Module1.Main, then you can run a macro that is in a vba module.

here is a commandbutton in a toolbar macro to show a form from vba: this is in the "macro associated with this button" , macro property of my toolbar button:

-vbarun module1.showform1
0 Likes
Message 4 of 6

Anonymous
Not applicable
"10west" <10west@sprynet.com> wrote in message
news:f198678.1@WebX.maYIadrTaRb...
you need to use the _vbarun command, then specifiy the macro name like
module1.myMacro, or the path to the macro like:
C:\ProjectsX\$VBER1\$VBmicroLandscape\VBAconversions\Editing\LayerStandardEn
forcer.dvb!Module1.Main, then you can run a macro that is in a vba module.
here is a commandbutton in a toolbar macro to show a form from vba: this is
in the "macro associated with this button" , macro property of my toolbar
button:
-vbarun module1.showform1

thanks, that works
but now i'm wondering why so many calls - isn't there a more direct solution
?
0 Likes
Message 5 of 6

Anonymous
Not applicable
probably not, since lisp is loaded and becomes a "command" in the commandline sense, you could probably make a lisp routine that did that exact same command line commnd -
(defun C:EL ()
(command "-vbarun" "module.macroname")


vbarun, etc thing then call that from a single word or character at the command line, but you would have to have the lisp loaded. just be glad you're not stuck in version 11, hehe
0 Likes
Message 6 of 6

Anonymous
Not applicable
"10west" <10west@sprynet.com> wrote in message
news:f198678.3@WebX.maYIadrTaRb...
probably not, since lisp is loaded and becomes a "command" in the
commandline sense, you could probably make a lisp routine that did that
exact same command line commnd -
(defun C:EL ()
(command "-vbarun" "module.macroname")
vbarun, etc thing then call that from a single word or character at the
command line, but you would have to have the lisp loaded. just be glad
you're not stuck in version 11, hehe

ok then thanks
0 Likes