XL5: GP Fault Running Macro After Adding Option Private

Last reviewed: September 12, 1996
Article ID: Q120197
The information in this article applies to:
  • Microsoft Excel for Windows, version 5.0

SYMPTOMS

In Microsoft Excel, you receive a general protection (GP) fault if you run a macro using the Macro dialog box after adding the Option Private Module statement to a procedure in an open workbook.

Another symptom of this problem is that a name appears in the Macro Name/Reference list in the Macro dialog box, that does not correspond to a macro contained in any of the open workbooks.

CAUSE

This problem occurs if you display the Macro dialog box, or run a procedure using the Run Macro button, and then add the Option Private Module statement to a procedure in an open workbook. The problem only occurs when you display the Macro dialog box while a module sheet is not the active sheet, after adding the Option Private statement.

The problem occurs because the Macro dialog box does not update correctly with the new macro information. When you add the Option Private Module statement to the beginning of an module, the procedures that are contained in that module do not appear in the Macro dialog box. However, if you run a procedure, or display the Macro dialog box, and then add statement to an open module, you receive a GP fault if you run a procedure using the Macros dialog box while the active sheet is not a module sheet.

Note that you may also receive a GP fault when you choose Cancel in the Macro dialog box.

WORKAROUND

To avoid receiving a GP fault after adding the Option Private Module statement to a Visual Basic module, do either of the following:

  • Run the procedure by using the Run Macro button on the Visual Basic toolbar instead of using the Macro dialog box.

    -or-

  • Select a module sheet before you choose Macro from the Tools menu.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel version 5.0c for Windows.

REFERENCES

For more information about the Option Private Statement, choose the Search button in the Visual Basic Reference and type:

    Option Private


KBCategory: kbprg
KBSubcategory:

Additional reference words: 5.00 gpf



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 12, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.