Reputation: 91
after my last venture with dictionaries i tried this code:
Dim data, tmpDict As Dictionary
Set data = New Dictionary
data.Add "abc", "abc"
Set tmpDict = New Dictionary
data("abc") = tmpDict
And got a runtime error
error 450 - Wrong number of arguments or invalid property assignment
So, here is my question: how can I change a dictionary item that is a string to another dictionary, so it becomes nested to the first?
Upvotes: 0
Views: 210
Reputation: 12655
Do you maybe want to have tmpDict
as the returning value for the key abc
? In that case, you should nest since the beginning:
Dim data, tmpDict As Dictionary
Set data = New Dictionary
Set tmpDict = New Dictionary
data.Add "abc", tmpDict
Or, if you want to keep the structure of your code, you should use the keyword Set
since you're setting a reference to an object:
Dim data, tmpDict As Dictionary
Set data = New Dictionary
data.Add "abc", "abc"
Set tmpDict = New Dictionary
Set data("abc") = tmpDict
I confess I might have misunderstood the question, please tell me in that case and I will edit/remove my answer.
Upvotes: 1