WD: No "Pause" Command in WordBasic

ID: 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 95, 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 "More Information" 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 "as is" 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 "xxxx" is the name of the second macro:

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

   ToolsCustomizeKeyboard .KeyCode = 13, .Category = 2, \ 
   .Name = "xxxx",  .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


REFERENCES

"Microsoft Word for Windows Technical Reference," page 77

"Microsoft Word for Windows and OS/2 Technical Reference," pages 224-225

Additional query words: pausing

Keywords : kbmacro wordnt kbmacroexample winword ntword macword word6 winword2 word7 word95
Version : MACINTOSH:6.0,6.0.1; 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; winnt:6.0
Platform : MACINTOSH WINDOWS winnt
Issue type : kbhowto


Last Reviewed: December 23, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.