Microsoft KB Archive/120197

{|
 * width="100%"|

XL5: GP Fault Running Macro After Adding Option Private

 * }

-

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