Visual Basic for Applications Reference

Private Statement Example

This example shows the Private statement being used at the module level to declare variables as private; that is, they are available only to the module in which they are declared.

  
    
      Private
     Number As Integer   ' Private Integer variable.
Private NameArray(1 To 5) As String   ' Private array variable.
' Multiple declarations, two Variants and one Integer, all Private.
Private MyVar, YourVar, ThisVar As Integer