Reputation: 403
This code causes an error for me:
i = 0
Set colors = CreateObject("Scripting.Dictionary")
Do While i < 7
If True Then
Dim a(1)
a(0) = "go"
a(1) = "tRY"
colors.Add "space", a
End If
i = i + 2
Loop
I'm not too sure why. I need to do something similar, where I initialize a dictionary with one array for each key, but the while loop seems to be messing it up. Any suggestions? Thanks!
Upvotes: 0
Views: 93
Reputation: 16311
Once you've dimmed an array, it cannot be dimmed again. It can, however, be ReDim
ed. Dim it outside the loop. If you want to clear the array during each loop, you can do one of the following:
ReDim a(1) ' ReDim without 'Preserve' will clear the array
' or
Erase a
Upvotes: 2