Microsoft Office Specialist When performing a task requires a series of commands, you can create a macro to automate the process, which will reduce the number of steps involved in a task and save you time. A macro is a recorded series of commands (keystrokes and instructions) that are treated as a single command.
You can use macros to automate many tasks in Word, such as creating form letters, inserting AutoText, formatting text, creating tables, and turning command options on and off. For example, suppose The Garden Company uses a special design for tables or charts that appear in marketing materials and correspondence. Instead of employees having to manually create and format a table—insert it, add shading and borders, apply character formatting to column and row headings, and then adjust the line spacing—each time they write a new document, a macro, executed at the click of a button, could perform all these steps, saving time and reducing the chances of error.
Important | Macros can contain viruses—destructive computer programs that can destroy information and other programs on your computer. If you frequently run macros created by other people, you should purchase and install special anti-virus software. To further reduce the risk of virus infection in Word files, set your computer’s macro security level to High or Medium by pointing to Macro on the Tools menu, clicking Security, clicking the Security Level tab, and then selecting the security level you want. |
The simplest way to create a macro is to record the steps required to complete the desired task. You can then repeat the steps at any time by running the macro. You start by pointing to Macro on the Tools menu and clicking Record New Macro. In the Record Macro dialog box, you specify a name and storage location for the macro. (Macros are not separate files; they are stored and work only in conjunction with the document or template for which they were created.) You then carry out the steps for completing the task, clicking the Stop Recording button when you have finished.
Tip | By default, new documents are based on the Normal template. If you associate macros with the Normal template, they will always be available to new documents (unless you base them on a different template). |
Before you run a macro, you position the insertion point where you want the result of the macro to be displayed. For example, if the macro inserts a table, you click where you want the table to appear. To run a macro, you point to Macro on the Tools menu and click Macros to display the Macros dialog box. You click the macro you want, and then click Run. (Or you can double-click the macro name.)
Tip | You can place a button for a macro you use frequently on a toolbar, or you can assign it a shortcut key combination so that the macro is readily available and easily executed. |
In this exercise, you will create a macro that formats the basic elements of a letter, and then you’ll run the macro.
USE | the RecordMacro document in the practice file folder for this topic. This practice file is located in the My Documents\Microsoft Press\Word 2003 SBS\IncreasingEfficiency\CreatingMacro folder and can also be accessed by clicking Start/All Programs/Microsoft Press/Word 2003 Step by Step. |
OPEN | the RecordMacro document. |
Press [CONTROL]+[END] to move the insertion point to the blank line below the logo for The Garden Company.
On the Tools menu, point to Macro, and then click Record New Macro to open the Record Macro dialog box.
In the Macro name box, type Letter.
Click the down arrow to the right of the Store macro in box, and click RecordMacro (document).
Tip | You can assign a macro to a toolbar or menu before or after you record the macro. If you aren’t sure that you want to assign your macro, you can create it first and assign it to a toolbar or menu later. |
Click the Keyboard button to open the Customize Keyboard dialog box, press [ALT]+ (the lowercase el) to place that key combination in the Press new shortcut key box, click Assign, and click Close.
Word closes the Customize Keyboard dialog box and displays the Stop Recording toolbar, which has buttons you can click to stop or pause the recording.
In the document, type The Garden Company, and press [ENTER].
Type 1234 Oak Street, and press [ENTER].
Type Seattle, WA 10101, and press [ENTER] three times.
On the Insert menu, point to AutoText, point to Salutation, and click To Whom It May Concern:.
The words To Whom It May Concern: are inserted into the document.
Press [ENTER] three times.
On the Insert menu, point to AutoText, point to Closing, and then click Respectfully yours,.
The words Respectfully yours, are inserted into the document.
Press [ENTER] three times.
Type Karen Berg, and press [ENTER].
Type Owner, and press [ENTER].
Type The Garden Company.
Stop Recording
On the Macro toolbar, click the Stop Recording button.
The macro stops recording, and the Stop Recording toolbar closes.
On the Tools menu, point to Macro, and click Macros.
The Macros dialog box appears.
In the list of macros, click Letter, and click Run.
The placeholders for a second letter are inserted in the document, below the ones you typed while recording the macro.
Save
On the Standard toolbar, click the Save button to save the document.
CLOSE | the RecordMacro document. |