Syntax 

Public [WithEvents] vardeclaration[, ...]


Group 

Declaration 


Description 

Create arrays (or simple variables) which are available to the entire macro and other macros. Dimension var array(s) using the dimensions to establish the minimum and maximum index value for each dimension. If the dimensions are omitted then a scalar (single value) variable is defined. A dynamic array is declared using ( ) without any dimensions. It must be ReDimensioned before it can be used. The Public statement must be placed outside of Sub, Function or Property blocks.


See Also 

Dim, Option Base, Private, ReDim, Static, WithEvents


Example

Public A0, A1(1), A2(1,1)

 

Sub Init

    A0 = 1

    A1(0) = 2

    A2(0,0) = 3

End Sub

 

Sub Main

    Init

    Debug.Print A0; A1(0); A2(0,0) ' 1 2 3

End Sub