Microsoft KB Archive/63646

Word: How to Write a Macro That Returns to the Original Window

PSS ID Number: Q63646 Article last modified on 01-24-1995

5.00

MS-DOS

= SUMMARY =

This is a sample macro for use when starting from any window, switching to other windows to run macro commands, then returning to the original window. The macro works only in Word version 5.00; earlier versions of Word do not recognize “Field” and “Window” as reserved variables.

In this example “<<” and “>>” represent chevrons and can be inserted in the text be using CTRL+[ or CTRL+] respectively.

Below is the text of the sample macro:

wm <>  : : : <>

This macro sets the “x” variable to the value of “Field”, which is the current window number. The string of colons represent the rest of the macro functions. At the end of the macro, the “set Window = x” command is used to return to the window where the macro began.

KBCategory: kbother kbmacro KBSubcategory: Additional reference words: ============================================================================= Copyright Microsoft Corporation 1995.