Running a Macro

To give you flexibility in automating your work, Office provides you with five methods for running your macros. You can do the following:

  • Choose Macros from the Macro submenu of the Tools menu, and then double-click the macro name in the Macro dialog box.
  • Press a macro shortcut key (if one has been assigned).
  • Choose the macro from a menu (if you added the macro name to a menu).
  • Click a custom macro button on a toolbar (if you assigned the macro to a toolbar button).
  • Start the Visual Basic Editor, and run the macro inside the Visual Basic development environment.

Using the Macros Dialog Box

To run a macro using the Macros dialog box, follow these steps:

  1. Press Enter to add a blank line to your document.
  2. Choose the Macro submenu on the Tools menu, and then click Macros. You'll see the following dialog box:

    click to view at full size.

    The Macros dialog box is a comprehensive tool for managing macros. Using the Macros dialog box, you can run, debug (step into), edit, record (create), delete, and organize macros.

    TIP
    Because the Macros dialog box is so useful, you might want to memorize the keyboard shortcut for opening it (Alt+F8).

  3. In the Macros In drop-down list box, specify the location of the macro you want to run. By default, the macros in all your active (open) Word templates and documents are listed, but you can also list the macros in a specific template or document by picking a name from the Macros In list box.
  4. Finally, in the Macro Name list box, double-click the macro you want to run. If you double-click the InsertAddress macro, your company address text will be inserted into the current document, as shown in the following illustration:

    click to view at full size.

Using a Shortcut Key to Run Macros

If you assigned a shortcut key to your macro when you created it, you can also run it in Word by pressing the designated shortcut key. To run the InsertAddress macro using the Alt+A shortcut key, follow these steps:

  1. Press Enter to add a blank line to your document.
  2. Press Alt+A to run the InsertAddress macro. Word runs the macro and inserts your company address in the current document. That's all there is to it!

TIP
How Do I Undo a Macro?

After you run a macro, the Undo command on the Edit menu works a little differently than you might expect. Rather than undo the entire macro, the Undo command only reverses the last command executed in the macro. If your macro contains several commands or keyboard operations, such as the InsertAddress macro, you can only reverse the macro by clicking the Undo drop-down list box on the Standard toolbar and then selecting all the commands in the macro. As you'll see in the next section, Office stores each Visual Basic command separately in your macro.



Running Microsoft Office 2000 Small Business
Running Microsoft Office 2000
ISBN: 1572319585
EAN: 2147483647
Year: 2005
Pages: 228

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net