Microsoft KB Archive/74630

{|
 * width="100%"|

WD: No &quot;Pause&quot; Command in WordBasic

 * }

Q74630

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 1.0, 1.1, 1.1a, 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
 * Microsoft Word for Windows NT, version 6.0
 * Microsoft Word for Windows, versions 7.0, 7.0a
 * Microsoft Word for the Macintosh, versions 6.0, 6.0.1

-

SUMMARY
In WordPerfect there is a macro command called PAUSE that suspends the macro for user input until the user presses ENTER, at which point the macro continues. There is no WordBasic command to pause a running macro in this manner.

The &quot;More Information&quot; section of this article discusses a method you can use to simulate the functionality of the PAUSE command.

MORE INFORMATION
To simulate this behavior in Word, use one of the following methods.

WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code &quot;as is&quot; without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

Method 1: Use macros and an Assigned Key Command
Create two macros; the first will end at the pause, the second will start after the pause.

Reassign the ENTER key to run the second macro by adding the following line to the end of the first macro, where &quot;xxxx&quot; is the name of the second macro:

  ToolsCustomizeKeyboard .KeyCode = 13, .Category = 2, \ .Name = &quot;xxxx&quot;, .Add Add the following line to the beginning of the second macro, where &quot;xxxx&quot; is the name of the second macro:

  ToolsCustomizeKeyboard .KeyCode = 13, .Category = 2, \ .Name = &quot;xxxx&quot;, .Remove

Method 2: Use a Message Box
Insert a MsgBox command at the point where you want to pause to allow user intervention. This MsgBox should prompt the user to press a certain key combination (such as CTRL+Z) when ready to resume the macro.

Place the commands for the remainder of the macro into another macro and assign it the key combination referenced in the MsgBox. When you press this key combination, this macro runs, creating a pause effect between the first and second macro.

For information about how to do this in Word 97, please see the following article(s) in the Microsoft Knowledge Base:

"Q159484 Simulating a Macro Pause in Word 97"