Dim Definition

Syntax:

Dim [WithEvents] name[type][([dim[, ...]])][As [New] type][, ...]

Group: Declaration

Description:
Dimension var array(s) using the dims to establish the minimum and maximum index value for each dimension. If the dims are omitted then a scalar (single value) variable is defined. A dynamic array is declared using ( ) without any dims. It must be ReDimensioned before it can be used.

See Also: Begin Dialog, Dialog, Option Base, Private, Public, ReDim, Static, WithEvents.

Example:

Sub DoIt(Size)
  Dim C0,C1(),C2(2,3)

  ReDim C1(Size) ' dynamic array
  C0 = 1
  C1(0) = 2
  C2(0,0) = 3
  Debug.Print C0;C1(0);C2(0,0) ' 1 2 3
End
Sub

Sub Main
  DoIt 1
End
Sub