This browser does not support basic Web standards, preventing the display of our site's intended design. May we suggest that you upgrade your browser?

Microsoft Word 2007

Working with Macros

A macro is a shortcut for performing a series of actions and is useful for automating complex or repetitive tasks. Macros are helpful if the work is being shared with someone else because it is easier to explain how to use a shortcut than it is to explain several steps. For a macro to be worthwhile, the series of actions you wish to accomplish must be consistent.

Once your macro is created you can run it using the Macros dialog box or, if you assigned it a keyboard combination or Quick Access toolbar button, by using a shortcut. If you have not created your macro, refer to Creating Macros for more information.

return to topRunning a Macro

Macros can be run from the Macros dialog box or, depending on how you initially set up the macro, a shortcut accessed from either the keyboard or a button on the Quick Access toolbar.

WARNING: Before running a macro, it is strongly recommended that you use the Save As command to create another copy of the document to which you are applying the macro. By doing so you will retain an unaltered version of the document if the macro does not work as intended. This precaution is especially recommended before running a macro on large, time-intensive projects. For smaller projects it may suffice to use the Undo command or to close the file before saving any unwanted changes.

Running a Macro: Dialog Box Option

  1. If an insertion point is critical, set it in the appropriate location

  2. From the Ribbon, select the Developer command tab

  3. In the Code group, click MACROSMacros button
    The Macros dialog box appears.
    Macros dialog box

  4. From the Macro name scroll list, select the macro you want to run

  5. Click RUN

Running a Macro: Keyboard Option

Word allows you to assign your macro keyboard combinations, which can be used to run the macro.

HINT: To learn how to assign a keyboard combination to your macro, refer to Assigning Macros to Additional Locations

  1. If an insertion point is critical, set it in the appropriate location

  2. Press the appropriate keyboard combination
    The macro runs.

Running a Macro: Button Option

Word allows you to assign your macro a Quick Access toolbar button, which can be used to run the macro.

HINT: To learn how to assign a Quick Access button to your macro, refer to Assigning Macros to Additional Locations

  1. If an insertion point is critical, set it in the appropriate location

  2. From the Quick Access toolbar above the Ribbon, click the appropriate button
    The macro runs.

return to topSuspending a Macro

If you are running a macro and need to suspend it (i.e., stop or pause), you may easily do so.

  1. Press [Esc]
    The macro is suspended.

  2. To restart the macro, you must run the macro again
    The macro resumes from the point in the document at which it was suspended.

return to topDeleting a Macro

WARNING: If you delete a macro, it will be removed from the template and will not be available in any document.

NOTES:
Make sure your macro is not currently running. If it is, suspend the macro.
Deleting a macro does not remove the changes it has previously applied.

  1. From the Ribbon, select the Developer command tab

  2. In the Code group, click MACROSMacros button
    The Macros dialog box appears.
    Macros dialog box

  3. From the Macro name scroll list, select the macro you want to delete

  4. Click DELETE
    A confirmation dialog box appears.

  5. Click YES

  6. Repeat steps 1–4 until all the unwanted macros are deleted

  7. Click CLOSE

return to topThe Visual Basic Editor

Some advanced macros (e.g., interactive macros) require knowledge of the Visual Basic programming language. Programming knowledge is also required to edit macros. While programming is beyond the scope of this document, for those already familiar with the Visual Basic language, Word's Visual Basic editor is easily accessed.

  1. From the Ribbon, select the Developer command tab

  2. In the Code group, click VISUAL BASICVisual Basic button
    The Visual Basic editor opens in a new window.

Excellence. Our Measure. Our Motto. Our Goal.