Running a Macro from a Toolbar


Write or Record the Macro

Any macros that you want to be accessible from any documents should be saved into your Normal.dot template.
The Normal.dot is your global template and is always open when Word is open meaning that the macros are available when any document is open.
If you are recording a macro the "Save in" drop-down box will default to Normal.dot unless you have another template or add-in open.
If the active document is attached to a different template (i.e. not Normal.dot) you can use the drop-down to select this template. This will allow you to make customisations specific to the documents based on that template.


Display the Customise dialog box

Before you do that make sure that the toolbar you want to add the button to is visible.
Select (View > Toolbars > Customise) or alternatively select (Tools > Customise).
Select the Commands tab. Scroll to the bottom of the Categories list and select "Macros".
In the Commands list box, will be a list of all the macros that are available in the current template.

alt text

This tells us that we have one macro available in the Normal.dot template called "BoldSelectedText".


Add the additional Toolbar button

To add this button to an existing toolbar you need to drag the button and release it on the desired toolbar.
You will see a black line appear indicating where the button will appear if you release the mouse button.


Important

If you want to save the changes in a Word add-in then you need to open the add-in as a document first.


© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited TopPrevNext