<img src=/S/hello.gif border=0 alt=hello width=25 height=29> Loungers
How does one fully qualify the OnAction of a ToolBar button entry so that it can tell what macro code to run in MS-Word?
Thanks
Wassim
<img src=/S/hello.gif border=0 alt=hello width=25 height=29> Loungers
How does one fully qualify the OnAction of a ToolBar button entry so that it can tell what macro code to run in MS-Word?
Thanks
Wassim
<img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

This month, every Windows Secrets subscriber can download a one-chapter excerpt of Windows 7: The Missing Manual.Windows 7: The Missing Manual provides valuable information to help you overcome these difficulties in learning a new operating system. Subscribe today to download your free excerpt.
Just use something like
CommandBars("MyToolbar").Controls("MyControl").OnA ction = "MyMacro"
If you want to specify the module that contains the macro:
CommandBars("MyToolbar").Controls("MyControl").OnA ction = "MyModule.MyMacro"
If you want to call a macro in another template, create a macro in the current template that calls it using Application.Run, and specify the macro in the current template in OnAction.
<img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15> Hnas
There is no MyDocument level in the "MyModule.MyMacro"?
Like in MS-Excel ThisWorkbook or MyWorkbook?
Wassim
<img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>
Macros are usually stored in standard modules, not in ThisDocument, so there is no need for ThisDocument. Neither would you use ThisWorkbook when assigning OnAction in Excel.
To get the preferred syntax, I would drag the macro to the menu bar temporarily, interrogate its properties using the Immediate window, then delete it. Kinda like recording a macro. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>