Public/Global Variables Not Maintained After Error (155457)
The information in this article applies to:
- Microsoft Excel 97 for Windows
- Microsoft Excel 98 Macintosh Edition
This article was previously published under Q155457 SYMPTOMS
When you run a Microsoft Excel Visual Basic for Applications macro that
contains a public variable, Excel reinitializes the public variable if an
error condition halts the execution of the macro. This is different
behavior from earlier versions of Microsoft Excel and Visual Basic for
Applications.
CAUSE
The mode that stops the code execution, but keeps the stack variables was
removed.
MORE INFORMATION
In earlier versions of Microsoft 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 Microsoft Excel 97 and Excel 98, this mode was 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.
REFERENCES
For more information about public variables, click the Index tab or
button in Microsoft Excel Help, type the following text
and then double-click the selected text to go to the "Public Statement"
topic.
Modification Type: | Minor | Last Reviewed: | 10/10/2006 |
---|
Keywords: | kbdtacode kbProgramming KB155457 |
---|
|