Private module variable : Variable Scope « Language Basics « VBA / Excel / Access / Word






Private module variable

 

Option Explicit
Private intModuleVariable As Integer
Public Sub TestProc1()
    intModuleVariable = intModuleVariable + 1
End Sub
Public Sub TestProc2()
    Debug.Print intModuleVariable
End Sub
Public Sub TestProc3()
    Dim intModuleVariable   As Integer
    intModuleVariable = 100
    Debug.Print intModuleVariable
End Sub

 








Related examples in the same category

1.Local variable
2.Procedure-Level (Local) Variables
3.module-level variable declared with Private statement
4.Understanding Module-Level Variables
5.Public Variables
6.Understanding and Using Static Variables
7.sub module scope
8.Module level variable
9.Local variables are available only in the procedure where they are declared