Record a Macro in Microsoft Word
The following is step-by-step instructions you need to record a macro, make the macro available for use in any single file or for use in any file you open, and assign a toolbar button to run the macro. It's easy!
One of the best reasons for creating a macro is to quickly switch printers. Anyone who uses Word a lot knows that when you choose a different printer, it can sometimes affect your document layout. So when you design a document you know will be printed to a specific printer, you should choose that printer while you design it. Rather than going to FilePrint and changing the printer, just hit a button on your toolbar. I had several such buttons at one of my jobs because we had the black & white printer, the little $40,000 color printer, and the quarter-million-dollar color printer. It was important that I not print the wrong way when printing these super-high-color jobs in huge quantities.
The next time you need to perform this or a similar task, record the tasks as a macro and you will only have to press a button to perform them again.
Step 1: Prepare to Record
If you would like the macro to be available only in a specific file, open that file first.
From the menu, choose Tools Macro Record New Macro. The following dialog box will appear:
In the Macro name box, enter the name you would like to use for your macro. It must not have any spaces and should not contain special characters.
Decide where to store the macro. If you would like it available in the current document only, hit the Store Macro in drop-down box and select your active document's name. If you would like the macro to be available for use with any file, select All Documents (Normal.dot).
Give the macro any description you like in the Description box. By default, the description will state the date the macro was recorded, and the user name. The user name automatically comes from the information under Word's Tools-Options, User Info tab.
Step 2: Assign the Macro to a Toolbar Button
Click on the Toolbars button.
The Customize dialog will appear. Make sure you're on the Commands tab.
In the right column, you will see an icon with a title similar to your macro's name. Click on the icon and drag it up to any location you choose on any toolbar you choose. Your mouse pointer must have a plus sign (+) hanging on it before you lift your finger from the mouse or the icon will not be placed. (While dragging, you will see an X hanging on your mouse pointer.)
Once your icon is placed on a toolbar, click the Modify Selection button, and various options will appear. The following describes only those options that apply for our purposes here:
Name: Type in the name of the macro as it should appear on your toolbar if you are going to use the text style button (described below).
Reset Button Image: Select this only if you have begun to edit an existing button image and you would like to reset it to the default.
Edit Button Image: Select this option to "draw" your own button image.
Change Button Image: Select this option to change the existing button image to one of your choosing from Office's collection of button images.
Default Style: Clicking this button makes the button on the toolbar show just the icon and no text.
Text Only (always): Clicking this button makes the button on the toolbar show just the text as it is shown in the Name box, which you can change.
Image and Text: Clicking this button makes the button on the toolbar show both the icon and the text.
When the button appears exactly as you would like it to appear on the toolbar, hit the close button on the Customize dialog box. The Stop Recording toolbar appears. There are two buttons on the Stop Recording toolbar. The square is used to STOP recording and the lines and circle are used to PAUSE recording.
Tip: If you accidentally close the Stop Recording toolbar, go to View-Toolbars and put a checkmark in the Stop Recording toolbar checkbox. If you accidentally use the X on the Stop Recording toolbar to stop recording a macro, go to View-Toolbars and put a checkmark in the Stop Recording toolbar checkbox and then use the appropriate button.
Step 3: Record the Macro
Perform the tasks you would like your new macro to perform for you. If you need to interrupt the macro recording to perform some non-related work, press the Pause button on the Stop Recording toolbar. Press the Pause button again to continue recording. Hit the Stop button to Stop recording when you have finished recording your tasks.
Step 4: Test the Macro
Always test a macro, particularly if you have created it to run for someone else. To test the macro, click on the toolbar button you've created, or hit Tools-Macro-Macros, and double-click the macro name.
For more information and assistance on using macros and VBA programming in Microsoft Office, see the best VBA website in the world (created by yours truly): www.VBAExpress.com