Microsoft KB Archive/99876

{| = Excel: GP Fault Running Tutorial with Auto_Close Macro Open =
 * width="100%"|

Last reviewed: September 12, 1996

Article ID: Q99876 The information in this article applies to:
 * Microsoft Excel for Windows, versions 4.0, 4.0a

SYMPTOMS
In Microsoft Excel versions 4.0 and 4.0a, when you run the Introducing Microsoft Excel or Learning Microsoft Excel tutorials, you may receive a general protection (GP) fault if you have a document open that runs an Auto_Close macro if that Auto_Close macro contains a CLOSE or FILE.CLOSE statement.

STATUS
Microsoft has confirmed this to be a problem in the versions of Microsoft Excel listed above. This problem was corrected in version 5.0 of Microsoft Excel for Windows.

MORE INFORMATION
When you choose one of the Microsoft Excel tutorials from the Help menu, all open files and workspace settings are saved to a workbook file, CBT.XLW, which is then closed. When you exit the tutorials, Microsoft Excel opens the CBT.XLW file to restore your files and workspace settings. The GP fault appears to occur at the point that the CBT.XLW file is being created.

You can designate a macro to run when a document is closed by creating the defined name Auto_Close for the document and specifying the macro that you want to run in the Refers To section of the Define Name dialog box. An Auto_Close macro is activated when you close a file by choosing Close from the File menu or by executing a CLOSE or FILE.CLOSE statement from another macro (not the Auto_Close macro).

If you run one of the tutorials while a document containing an Auto_Close defined name is open, the Auto_Close macro will be run before the tutorial is launched. If the Auto_Close macro contains a CLOSE statement to close the active window, or a FILE.CLOSE statement to close the active document, you may receive a GP fault when you try to run the tutorial.

Workarounds
If your macro does not activate another sheet prior to executing the CLOSE or FILE.CLOSE statement:


 * Remove the CLOSE or FILE.CLOSE statement from the file containing

the Auto_Close defined name.

Note: These statements are unnecessary in the Auto_Close macro because, by design, the macro must be activated by choosing Close from the File menu or by a CLOSE or FILE.CLOSE statement in another macro. Therefore, you can remove these statements from your macro without any loss of functionality. If your macro activates another sheet prior to executing the CLOSE or FILE.CLOSE statement:
 * Close the document containing the Auto_Close defined name before you run the tutorial.