I am looking for assistance with regards to the code snippet below. I am attempting to assign a dynamic array (NewArray) of user-defined type, TestThis, to a Variant variable of another user-defined type, TestThisList. When attempting to compile this code, I get a “Type mismatch on: NEWARRAY” error, at the line I am attempting the assignment. I believe I should be able to make this assignment. What am I missing? Any suggestions would be much appreciated
(Declarations)
Type TestThis
testNumber As Integer
testString As String
testBoolean As Boolean
End Type
Type TestThisList
id As String
typeHolder As Variant
End Type
Dim ListHolder() As TestThisList
Sub Initialize
Dim NewArray() As TestThis
Redim Holder(3) As TestThisList
Redim NewArray(3) As TestThis
NewArray(0).testNumber = 2
NewArray(0).testString = "Hello"
NewArray(0).testBoolean = True
NewArray(1).testNumber = 4
NewArray(1).testString = "Goodbye"
NewArray(1).testBoolean = True
NewArray(2).testNumber = 6
NewArray(2).testString = "Blue"
NewArray(2).testBoolean = False
Holder(0).id = "9999"
Holder(0).typeHolder = NewArray
End Sub