OFF97: Displaying UserForm Designer Resets Global VariablesLast reviewed: March 17, 1998Article ID: Q169621 |
The information in this article applies to:
SYMPTOMSWhen you run a macro in a Visual Basic for Applications project, the value for a global variable is reset to nothing (zero).
CAUSEThis problem occurs when the following conditions are true:
RESOLUTIONTo resolve this problem and ensure that all global variables retain their scope, close all UserForm windows before running a macro in a Visual Basic project.
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.
MORE INFORMATIONThe scope of a variable is determined by the way you declare the variable. In Visual Basic for Applications, you can use three kinds of variables: procedure, module, and public. To declare a global variable, use the Public, Dim, or Private keyword in the Declaration section of the module or procedure. For additional information about the scope and lifetime of variables in Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q141693 TITLE : XL: Scope of Variables in Visual Basic for Applications REFERENCESFor more information about how long the value of a variable is retained, from the Visual Basic Editor, click Contents and Index on the Help menu, click the Index tab in Microsoft Visual Basic for Applications Help, type the following text
variables, lifetimeand then double-click the selected text to go to the "Lifetime of variables" topic.
|
Additional query words: 97 OFF97
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |