I want to use VBA to add a macro to a Word toolbar.
When I do this manually and record it in a macro, the resulting command is
simply:
CommandBars("Menu Bar").Controls.Add Type:=msoControlButton, Before:= 20
without any reference to the name of the given macro.
How do I write the VBA code to add a macro (say Normal.Modul1.Mymacro) to
the Standard toolbar in Word?
Thanks, Frank
Michael Schmidt - 26 Feb 2005 00:47 GMT
Try this:
dim objControl as Control
Set objControl = _
CommandBars("Menu Bar").Controls.Add(Type:=msoControlButton, Before:= 20)
objControl.OnAction = Normal.Modul1.Mymacro
Set objControl = Nothing
Michael.