Microsoft KB Archive/87430

{|
 * width="100%"|

WinWord: FileExit Command Does Not Run When You Press ALT+F4

 * }

Q87430

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
 * Microsoft Word for Windows, version 7.0

-

SUMMARY
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.

MORE INFORMATION
To make sure your AutoExit macro is stored globally, choose Template from the File menu. Under &quot;Store New Macros and Glossaries as,&quot; select either the Global option button or the Prompt For Each New option button, then choose the OK button.

Sample AutoExit Macro
  Sub Main Chdir &quot;C:\DOS&quot; MsgBox &quot;Changing directory to the C: Drive, DOS subdirectory&quot; 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"