CST2601 Visual
Basic I
Notes on Array
Array FunctionReturns a Variant containing an array. Syntax Array(arglist) The required arglist argument is a comma-delimited list of values that are assigned to the elements of the array contained within the Variant. If no arguments are specified, an array of zero length is created. Remarks The notation used to refer to an element of an array consists of the
variable name followed by parentheses containing an index number
indicating the desired element. In the following example, the first
statement creates a variable named
The lower bound of an array created using the Array function is determined by the lower bound specified with the Option Base statement, unless Array is qualified with the name of the type library (for example VBA.Array). If qualified with the type-library name, Array is unaffected by Option Base. Note A Variant that is not declared as an array can still contain an array. A Variant variable can contain an array of any type, except fixed-length strings and user-defined types. Although a Variant containing an array is conceptually different from an array whose elements are of type Variant, the array elements are accessed in the same way. Array Function ExampleThis example uses the Array function to return a Variant containing an array.
|