Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

XL2000: Public Variables Are Not Maintained After Error


View products that this article applies to.

This article was previously published under Q213248

↑ Back to the top


Symptoms

When you run a Microsoft Excel 2000 Visual Basic for Applications macro that contains a public variable, Excel reinitializes the public variable if an error condition halts the running of the macro. This is different behavior from earlier versions of Excel and Visual Basic for Applications.

The mode that stops the code execution but keeps the stack variables has been removed in the Excel 2000 version of Visual Basic for Applications.

↑ Back to the top


More information

In earlier versions of Excel and Visual Basic for Applications, there is a mode in the internal code that stops the code execution but keeps the stack variables. This is by design of Visual Basic for Applications.

In Excel 2000, this mode has been removed from the internal code to make it consistent with all other Visual Basic for Applications programs. When Visual Basic for Applications encounters an error that halts a macro, it resets the project stack, including all public variables.

↑ Back to the top


References

For more information about public variables, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type declaring variables in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Keywords: KB213248, kbprogramming, kbprb

↑ Back to the top

Article Info
Article ID : 213248
Revision : 6
Created on : 10/11/2006
Published on : 10/11/2006
Exists online : False
Views : 263