Microsoft KB Archive/231081

= XL2000: Referencing an Invalid UserForm Control Causes Excel to Crash =

Article ID: 231081

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Excel 2000 Standard Edition

-



This article was previously published under Q231081



SYMPTOMS
When you reference a UserForm control in a Microsoft Visual Basic for Applications macro, Microsoft Excel may stop responding, and you may receive the following error message:

This program has performed an illegal operation and will be shut down.

If the problem persists, contact the program vendor.

If you click Details, you receive an error message similar to the following:

EXCEL caused an invalid page fault in module in VBE6.DLL at 015f:65009f45



CAUSE
This problem may occur when all of the following conditions are true:
 * You have a RefEdit control on a user form.

-and-


 * You reference an invalid control in an event procedure for the RefEdit control.

-and-


 * You run the code from the Visual Basic Editor by clicking Run or pressing F5.

This problem does not occur if you display the user form by running a subroutine from Excel that shows the user form.



WORKAROUND
To prevent this problem from occurring, do not include a reference to a nonexistent control in an event procedure for a control. Such a reference will result in an error with controls other than RefEdit as well.

To work around this problem, use one of the following methods:

 Close the user form in the Visual Basic Editor before running the macro.

To close the user form, select the form in the Visual Basic Editor, and click the Close button ("X") in the upper-right corner of the document window, or press CTRL+F4.

-or-

  Show the user form with a subroutine using the Show method, and run the subroutine from Excel rather than in the Visual Basic Editor, for example: Sub Runner UserForm1.Show End Sub 



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
This problem has only been observed during code development, while testing code by running it from the Visual Basic Editor. Because the completed macro is usually run from Excel with a subroutine, this problem should not affect the completed Visual Basic for Applications macro.

Additional query words: XL2000 dll files forms in vba crash crashes crashing crashed quit quitting quits fail fails failing failed break

Keywords: kbbug kbdtacode kbpending KB231081

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.