- In referring, with the Preserve keyword, to a variable of type variant that doesn't already contain an array. For example:
Dim varV As Variant
varV = 5
ReDim Preserve varV(1 To 3) ' Illegal
Remove the keyword Preserve if you want varV to hold an array, or remove the Redim statement.
- You referred to a member variable of a class as though it were an array, though it isn't. For example:
Class AClass
Public X As Integer
End Class
Dim varV As Variant
Set varV = New AClass
ReDim varV.X(1 To 3) ' Illegal, because X isn't an array.
Declare X as a dynamic array or remove the ReDim statement.
- You referred to a member variable or property of a class as though it held or returned a dynamic array rather than a fixed array. For example:
Class AClass
Public X(1 To 2) As Integer
End Class
Dim varV As Variant
Set varV = New AClass
ReDim varV.X(1 To 3) ' Illegal, because X is a fixed array.
Define X as a dynamic array or remove the ReDim statement.