XL97: "Cannot Quit" After Using Visual Basic Editor

This article was previously published under Q172261
This article has been archived. It is offered "as is" and will no longer be updated.
Symptoms
When you quit Microsoft Excel 97, you may receive the following errormessage:
Cannot quit Microsoft Excel.
You are unable to quit Microsoft Excel 97.
Cause
This problem occurs if you attempt to quit Microsoft Excel 97 afterperforming either of the following actions:
  • You press F8 when the pointer is not inside a subroutine or a function. -or-

  • You press F8 when the pointer is in an empty Visual Basic module.
NOTE: If you subsequently run a Visual Basic macro or subroutine, theproblem does not occur.
Workaround
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs.
If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:

Microsoft Certified Partners - https://partner.microsoft.com/global/30000104

Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS If this problem occurs, run a Visual Basic subroutine. To run a subroutine,use either of the following methods:
  • In a Visual Basic module, place the cursor inside an existing subroutine, or type a new subroutine. Then, press F5 twice to run the subroutine.

    NOTE: If you use a new subroutine, it is recommended that you use a subroutine similar to the following:
          Sub Test()          MsgBox "This is a test."      End Sub						
    -or-

  • In Microsoft Excel 97, point to Macro on the Tools menu and click Macros. Then, click the name of a macro and click Run. Press F5 again to run the subroutine.
After you run a subroutine, you can quit Microsoft Excel 97.
Status
Microsoft has confirmed this to be a problem in the Microsoft productslisted at the beginning of this article. This problem no longer occurs in Microsoft Excel 2000.
More information
Normally, if you press F8 when the Visual Basic Editor is active, theselected subroutine or function is run in "step into" mode. When you run amacro in this mode, you can execute one line of code at a time by pressingF8 repeatedly. You can exit step into mode by pressing F5. The Visual BasicEditor also automatically exits Step Into mode when a macro is completed.

If you press F8 when the pointer is not inside a subroutine or function,Microsoft Excel 97 enters step into mode; however, no macro is active. As aresult, even though no macro is running, Microsoft Excel 97 behaves asthrough a macro is running. When this behavior occurs, you cannot quitMicrosoft Excel 97.
XL97
Properties

Article ID: 172261 - Last Review: 10/26/2013 14:46:00 - Revision: 3.0

  • Microsoft Excel 97 Standard Edition
  • kbnosurvey kbarchive kbbug kbdtacode kbprogramming KB172261
Feedback