The easiest way to create macros in Word is to record them.

by Cheryl Flanders Fri, Nov 14, 2003, 13:05:15 Reply   Forum

Anything you do manually can be recorded in a macro:
  1. Go to Tools/Macro/Record New Macro or double-click REC in the status bar. Name the macro. NOTE: no spaces or punctuation in the name.
     
  2. Click the keyboard button to assign a keyboard shortcut (or click the toolbar button). If assigning a keyboard shortcut, press the keys and check immediately below the box for possible key assignment to another command.
     
  3. Select where the macro will exist. If you select All Documents, the macro will be stored in your Normal.dot template and will be available for all Word documents. If you select the current document, the macro will only be available in that document.
     
  4. Once you make your choices, press Enter (or click OK) to begin recording your macro.
     
  5. You will see a small floating toolbar on your screen with two buttons on it. One is stop recording and the other is to pause recording.
     
  6. Make the appropriate mouse clicks, menu choices,
    or typing of text.
     
  7. When you are finished, click the Stop recording button.

While you are recording a macro, you can use the mouse to click commands and options, but the macro recorder does not record mouse movements in a document window. For example, you cannot use the mouse to move the cursor to select, copy, or move items by clicking or dragging. You must use the keyboard to record these actions.

To see your macro "code," go to Tools/Macro/Macros, select the name of your macro and click the Edit button. You will then see the code behind your macro in the Visual Basic Editor. You can also modify the code here. Another way to get into the Visual Basic Editor is to press ALT + F11 on your keyboard -- this brings you directly into the Visual Basic Editor.

~
Related link: http://www.cherylflanders.com


Edit | Reply | | | |   | Author | Forum