Array

This function creates a one-dimensional array whose elements are the objects or values passed as parameters.

Syntax

Array(arglist)

Parameters

arglist
Required. Comma-delimited list of values that is assigned to the elements of an array contained within the Variant. If no parameter is specified, an array of zero length is created.

Return Values

Returns a Variant containing a one-dimensional array.

Remarks

The notation used to refer to an element of an array consists of the variable name followed by parentheses containing an index number that indicates the desired element. In the following example, the first statement creates a variable named A. The second statement assigns an array to variable A. The last statement assigns the value contained in the second array element to another variable.

Dim A
A = Array(10,20,20)
B = A(2)

A variable that is not declared as an array can still contain an array. Although a Variant variable containing an array is conceptually different from an array variable containing Variant elements, you access the array elements in the same way.