Recording a Toolbar Macro
Now let's say that your company frequently submits competitive bids on projects. You want the company name in the watermark of each page so that no one confuses your brilliant ideas and proposals with those of your competitors. (Any subliminal advertising advantage is purely coincidental, of course.) Or perhaps you have a boss who persistently asks you to E-mail a copy of one document or another to a colleague when the document is only partially complete. The macro we'll create in this section could pop a DRAFT watermark onto your documents with a single click.
Let me offer a word of warning here. Word 2003 has a rather nice procedure for adding a watermark (Format, Background, Printed Watermark), but you won't be able to record that as a macro for one-button conveniencewell, you can record it, but it won't work when you're done. I'll say more on why in the troubleshooting section.
Before you begin this procedure, be sure that Word's Drawing toolbar is displayed. If it isn't, right-click any toolbar to display the toolbar menu and then select Drawing to display the toolbar.
To start recording the new macro, follow these steps:
Open a new, blank Word file.
Choose Tools, Macro, Record New Macro to open the Record Macro dialog box.
Type a name for your macro. (Remember, no blanks or other special characters.) Choose All Documents (Normal.dot) from the Store Macro In drop-down list.
Add a description if you like, but again DO NOT click OK. We're creating a macro that will be triggered with a toolbar button, so we need to assign the toolbar button before recording the macro. Click the Toolbars button in the middle of the dialog box. The Customize dialog box opens.
Click the Commands tab, if necessary. Macros will be highlighted in the Categories list, as shown in Figure 4. In the Commands list, click the name of the new macro you're creating and drag it out of the dialog box and over the Word toolbar where you want to place the button for the macro.
Drag the pointer over the Word toolbar of your choice and drop the button where you want to position it. You must position the button within one of the open toolbars.
While you're dragging the macro from the dialog box to the toolbar, the text disappears under the mouse pointer, replaced by a tiny blank toolbar button and a little box with an X, as shown in Figure 5.
Figure 4 Drag the macro title from this dialog box to a Word toolbar.
Figure 5 When you release the mouse button over a toolbar, the macro text will appear as your new button.
The cassette icon is added to the mouse pointer to indicate that you're recording a macro, and the Stop Recording toolbar appears. Continue recording the macro as described in the previous example.
Here's the procedure for putting a watermark in the center of your page. It sounds a little crazy because it begins by having you type some text in the header, but this is because any text you put in a header appears on every page, not just the one you're working onand you want your watermark on every page of your document. As long as we're talking crazy stuff, locate those arrow keys on your keyboardthe ones you never use unless you're playing a game and someone has stolen the mouse. You'll need the left arrow in a moment.
To create a watermark:
Choose View, Header and Footer.
In the header, type DRAFT (or whatever watermark text you want).
Hold down the Shift key and press the left-arrow key until you've highlighted the text.
Highlighting and selecting text in a macro is very tricky. This is the only way I know to do it.
Choose Format, Font to open the Font dialog box.
Click the Font tab and set font size, style, and color as desired. To create an attractive DRAFT watermark, I used these settings:
Color: Click open the Font Color drop-down list, click More Colors, and then click the second-lightest gray choice on the Standard tab in the Colors dialog box.
Size: 90. For a longer text message, use a smaller font size.
On the Drawing toolbar, click the Text Box button to put a text box around what you've typed. Double-click the edge of this text box to set up parameters. Here are the settings I used, and these are not optional:
Color and Lines tab: Set Line Color to No Line.
Size tab: Set Scale Height=100, Scale Width=100%. (Note: This is the second set of Height and Width parameters.)
Layout tab: For Wrapping Style, select Behind Text.
Click OK and use the arrow keys to position the text box in the center of the page.
Click the Stop Recording button on the toolbar to stop recording the macro.
Now that you have a moment to survey your work, you can see that you have a button on your toolbar with some catchy name like Normal.NewMacros.WMARK. That's a little wordy for the real estate of my screen. To change or shorten it, follow these steps:
Choose Tools, Customize to open the Customize dialog box.
Click the Commands tab. In the Categories list, select Macros.
In the Commands list, find the new macro (named something like Normal.NewMacros.WMARK), and click it.
A new button called Modify Selection appears in the dialog box. Click this button to display the menu shown in Figure 6.
Click Name on the menu and change the toolbar button's name to something more sensible, like WMARK or DRAFT.
Figure 6 You can use this dialog box to change the name on the new macro button.
You can also click the Change Button Image option and select a new image for the button. I like the open eye image, because I can find it easily on the toolbar. If you're artistic, you can even create your own low-res image by using the Button Editor.
Now you have an elegant little button that will apply your watermark whenever you want it. When you want to remove the watermark from a document, choose View, Header and Footer, click the text box, and press Delete. Or, now that you know how it's done, you can create an Un-WMARK macro button to do it for you!