I would like to declare a variant array that contains different data types such as objects.
Dim faceObj As SldWorks.Face2
Dim selObject() As Variant
ReDim Preserve selObject(4)
' code that initializes faceObj is not included here
Now, selObject has 5 elements, that are of Empty data type.
I would like to change a first element datatype to be of a Face2 class.
Set selObject(0) = faceObj
While this works, array elements still have the Object datatype and therefore members of the objects are not offered by lint.
Apologies if I used wrong nomenclature as I don't understand properly OOP terminology.
I tried ReDim selObject(i - 1) As SldWorks.Face2
but it says that can't change the datatype of array elements. I think I saw that in Variant it's possible to have the different datatypes but maybe my syntax is wrong.
Edit: Would it be better to rather use a structure array for this case?
Based on the comment section, it is not possible to redeclare elements to be of the different object class. It will still be the same Object data type.