Missing array subscript or collection index for: <name>
Either of two conditions could have caused this error:
- You included empty parentheses in a reference to the return value
of a function or property. This is not allowed. Assuming that the
function or property returns a Variant containing an array, list,
or reference to a collection, you can either remove the empty parentheses
or insert the appropriate subscript or subscripts. Removing the parentheses
makes the reference be to the entire array, list or collection, while
including the subscript or subscripts makes the reference be to a
single element in the array, list, or collection. For example:
Dim anArray(5) As Variant Function MyFunction(someArray()) As Variant ' ... MyFunction = someArray End Function varV = MyFunction(anArray)() ' Illegal. varV = MyFunction(anArray) ' Legal. Returns the contents ' of the array. varV = MyFunction(anArray)(1) ' Legal. Returns the first element ' of the array.
- You included empty parentheses in a reference to a class member
function that returns an array, list, or collection.
You can either remove the empty parentheses or insert the appropriate subscript or subscripts.