WD: Using RecordNextCommand Macro When Writing WordBasic Macros

ID: Q73113

The information in this article applies to:

SUMMARY

It is possible to use the RecordNextCommand macro to record the syntax of the next WordBasic command executed into an open macro window in Microsoft Word.

MORE INFORMATION

The RecordNextCommand macro can be helpful when you are writing a macro and are unsure of the syntax for a particular command. The RecordNextCommand will insert the syntax of the next command executed into the open macro window.

Word versions 6.x, 7.x

To activate the RecordNextCommand in Word for Windows 6.0 and 7.0, do the following:

1. In the Macro Editor, place the insertion point at the spot

   where you want the recorded command to begin.

2. Switch to an open document window from the Window menu or by
   pressing CTRL+F6 (COMMAND+F6 in WORD for the Macintosh), or open a new
   document.

3. From the Macro Editor toolbar, which is still showing above the Ruler,
   press the button second from left, a dot with a number "1" next to it.
   (If you're not sure which button, the Toolbar Hint will say
   "RecordNextCommand" when your mouse pointer is positioned on the
    button.)

4. Your mouse pointer will show an icon resembling an audio cassette, to
   indicate that the Macro Recorder is active.

5. Perform the action that is to be recorded into your macro.
   (You can re-press the button to abort the recording.)

6. Once the command is completed, the recorder will place the command
   syntax into the macro window. Switch back to the open macro sheet to
   view the recorded syntax.

There is no pre-assigned shortcut key for RecordNextCommand in Word for Windows version 6.x. For information about creating a shortcut key or assigning RecordNextCommand to a menu or toolbar, refer to pages 716-728 of the Microsoft Word for Windows version 6.0 "User's Guide."

Word for Windows version 2.x

To activate the RecordNextCommand in Word for Windows 2.x, do the following:

1. Switch to an open document window from the Window menu or open a

   document. (Make sure that you have a macro window open as well by
   choosing Edit from the Macro menu, giving a name to your macro, and
   then pressing ENTER.)

2. On the Tools menu, click Macro and press ALT+C to select the
   Commands option button in the Show box.

    This selects all macro commands.

3. Select RecordNextCommand from the list of available macros and
   press ENTER. (Make sure that you have opened a macro menu at this
   point by selecting Macro from the Tools menu and giving your macro
   a name. Choose Edit to open a macro window).

4. "REC" will now appear in the status bar at the bottom of the
   Word for Windows screen to indicate that the Macro Recorder is
   active.

5. Perform the command that is to be recorded into the macro sheet.

Word for Windows versions 1.x

To use the RecordNextCommand macro in Word for Windows version 1.x, position the cursor on the line where the recorded syntax should appear in the macro window, and do the following:

1. Switch to an open document window from the Window menu or open a

   document. (Make sure that you have a macro window open as well by
   choosing Edit from the Macro menu, giving a name to your macro, and
   then pressing ENTER.)

2. On the Macro menu, click Run and press ALT+A to select the
   Show All check box (if not already selected).

3. Select RecordNextCommand from the list of available macros and
   press ENTER.

4. "REC" will now appear in the status bar at the bottom of the
   Word for Windows screen to indicate that the Macro Recorder is
   active.

5. Perform the command that is to be recorded into the macro sheet.

Once the command is completed, the recorder will place the command syntax into the macro window. Switch back to the open macro sheet to view the recorded syntax.

NOTE: If no macro windows are open, the RecordNextCommand macro will beep when executed.

The RecordNextCommand macro can be added to the Macro menu by using the Assign To Menu function (refer to page 195 of the "Microsoft Word for Windows User's Reference" for more information on adding macros to menus).

REFERENCES

"Microsoft WordBASIC Primer," by Russell Borland, page 42 "Microsoft Word for Windows User's Guide," version 2, pages 764-5 "Microsoft Word for Windows User's Guide," version 6, pages 716- 728

Additional query words: macros code procedure

Keywords          : kbmacro wordnt winword ntword macword word6 word7 word95 
Version           : WINDOWS:1.0,1.1,1.1a,2.0,2.0a,2.0a- CD,2.0b,2.0c,6.0,6.0a,6.0c,7.0,7.0a; MACINTOSH:6.0,6.0.1,6.0.1a
Platform          : MACINTOSH Win95 WINDOWS winnt
Issue type        : kbhowto

Last Reviewed: February 3, 1998