Microsoft Office Development and Consultancy
|Word > Macros > Running a Macro from a Toolbar||< Previous | Next >|
Step 1 - 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.
Step 2 - 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.
(Tools > Customise) dialog box
This tells us that we have one macro available in the Normal.dot template called "BoldSelectedText".
Step 3 - 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.
Step 4 - Things to Remember
If you want to save the changes in a Word add-in then you need to open the add-in as a document first.
|© Better Solutions Limited 15-May-2013||< Previous | Top | Next >|