Global Versus Public in Visual BasicLast reviewed: July 29, 1997Article ID: Q115512 |
The information in this article applies to:
SUMMARYIn Microsoft Visual Basic version 3.0, you can use the Global statement in the Declarations section of a module to declare a global variable. Global variables are available to all procedures in all forms and modules. In Microsoft Visual Basic Programming System, Applications Edition, you can use the Public statement to declare a public variable, which makes the variable available to all procedures in the workbook or project. The Public statement in Visual Basic, Applications Edition, performs the same action as the Global statement in Visual Basic version 3.0. The name Public is more intuitive when thought of in context with its counterpart, Private. When you use the Private statement to declare a variable as private, the variable is available only to the module in which it is declared. The Global statement is supported for compatibility in Visual Basic, Applications Edition; however, Public is preferred.
REFERENCESFor more information about the Public Statement, choose the Search button in the Visual Basic Reference and type:
Public Keywords : kbprg Version : 1.00 Platform : WINDOWS |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |