Public Sub DoSomeThing()
Dim dict As Object
Dim arr2(5)
Set arr2() = aaa()
For m = LBound(arr2) To UBound(arr2)
Set dict = aaa()(m)
Dim key As Variant
For Each key In dict.Keys
Debug.Print dict(key)
Next key
Next
End Sub
Public Function aaa() As Variant
Dim arr(5)
Dim dict_123 As Object
For k = 1 To 2
If k = 1 Then
val1 = 300
val2 = 500
ElseIf k = 2 Then
val1 = 600
val2 = 1200
End If
Set dict_123 = CreateObject("Scripting.Dictionary")
dict_123.Add "first", val1
dict_123.Add "Second", val2
Set arr(k) = dict_123
Next
aaa = arr
End Function
Here I want to get return the Array from aaa to the DoSomething and process that array from DoSomeThing. How can I do that?
I am getting the error as can't assign to Array