XL Err Msg: "Not Enough Stack Space to Run Macro"Last reviewed: December 1, 1997Article ID: Q111867 |
The information in this article applies to:
SYMPTOMSIn Microsoft Excel, when you choose a control in a dialog box that is assigned to an event macro when there are a total of three dialog boxes on the screen that have not been dismissed, you may receive the following error message(s):
Not Enough Stack Space to Run Macro -or- Error 28: Out of Stack Space -or- Run-time error '28': Out of stack space WORKAROUNDTo avoid receiving either of these error messages when you call nested dialog boxes, do not assign a dialog control (such as a button or a check box) to a macro event that calls another dialog box. Instead, assign the control to first dismiss the active dialog box, then call the desired dialog box from the same the macro that called the first dialog box. To dismiss the active dialog box, do any of the following:
MORE INFORMATIONA dialog box is not updated until after the event macro has finished. The event macro is the code that is run when an action, such as choosing a button, is taken in the dialog box. Because the dialog box is not updated, if you call a dialog from another dialog, the first dialog is still loaded (stacked) and is not released until the code that it ran (calling the second dialog) has completed. This condition exists even if the property of the button that called the second dialog is set to dismiss. In Microsoft Excel 5.0, you can stack dialog boxes (that is, display more than one dialog box on the screen at one time) with the top dialog box active. You can stack two dialog boxes, and still run code assigned to controls on the second dialog box. For example, you can call Dialog Two from Dialog One, and then run a macro assigned to a control on Dialog Two by choosing the control. In addition, you can call Dialog Three from Dialog Two, but you cannot run any event macros from this top level (Dialog Three) dialog box. Note that you cannot hide a dialog box until the macro that hides the dialog box ends.
Visual Basic ExampleMicrosoft 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 engineers 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 the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/refguide/default.aspIn the following example, there are three dialog boxes. Each dialog box can call either of the other two dialog boxes. Each button is assigned to a macro that sets the value of a variable. The value of the variable determines which dialog box to display next.
REFERENCES"Visual Basic User's Guide," version 5.0, page 219-239
|
Additional query words: 7.00 5.00 5.0 overflow
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |