ID: Q87430
The information in this article applies to:
You can exit Microsoft Word for Windows by choosing Exit from the File menu, pressing ALT+F4, or choosing Close from the Application Control menu. Of these methods: File, Exit and ALT-F4 call the FileExit WordBasic command. Clicking Close from the Applications Control menu does not.
Therefore, if you want to run additional WordBasic macro commands whenever you exit Word for Windows, do not modify the FileExit command. To ensure that additional macro commands always run, create a global AutoExit macro instead.
The functionality of the FileExit command is by design.
To make sure your AutoExit macro is stored globally, choose Template from the File menu. Under "Store New Macros and Glossaries as," select either the Global option button or the Prompt For Each New option button, then choose the OK button.
Sub Main
Chdir "C:\DOS"
MsgBox "Changing directory to the C: Drive, DOS subdirectory"
End Sub
The above macro runs anytime you exit Word for Windows using one of
the methods described above.
For more information, query on the following words in the Microsoft Knowledge Base:
and auto
"Microsoft Word for Windows User's Guide," version 2.0, pages 768-784, 786
"Using WordBasic," by WexTech Systems and Microsoft, pages 87, 175, 196, 360
"Microsoft Word for Windows User's Reference," version 1.x, pages 186-189
"Microsoft Word for Windows and OS/2 Technical Reference," version 1.x, pages 97-99, 171
Kbcategory: kbusage kbmacro KBSubcategory: Additional query words: 2.0 2.0a 2.0a-CD winword2 6.0 word6 word7 winword 7.0 word95 winword
Version : 2.x 6.0 6.0a 6.0c 7.0
Platform : WINDOWS
Last Reviewed: July 30, 1997