Visual Basic for Applications Reference

Option Base Statement

See Also    Example    Specifics

Used at module level to declare the default lower bound for array subscripts.


Option Base {0 | 1}


Because the default base is 0, the Option Base statement is never required. If used, the statement must appear in a module before any procedures. OptionBase can appear only once in a module and must precede arraydeclaration that include dimensions.

Note   The To clause in the Dim, Private, Public, ReDim, and Static statements provides a more flexible way to control the range of an array's subscripts. However, if you don't explicitly set the lower bound with a To clause, you can use Option Base to change the default lower bound to 1.  The base of an array created with the the ParamArray keyword is zero; Option Base does not affect ParamArray (or the Array function, when qualified with the name of its type library, for example VBA.Array).

The Option Base statement only affects the lower bound of arrays in the module where the statement is located.