excel vba - Return Dictionary from Function or Sub in VBA -
I would like to create a sub object and start a sub object and use it in another. I could do everything in one and everything, but want to make the code modular, it gives "logic not optional" which is the latest error in the latest version of this code which I have tried to do, what am I doing wrong?
"Post-text" itemprop = "text">
1) CreateDictionary = aDictionary should be
setDictionary = set aDictionary
2) myDictionary = CreateDictionary should be
set myDictionary = CreateDictionary
3) MsgBox myDictionary.k
must be MsgBox myDictionary (k)
Correct code:
Function CreateDictionary () As a dictionary, aDictionary = set a new dictionary with aDictionary. Add key: = "key1", add item: = "value1" key: = "key2", item: = "value2" end = aDictionary close function with setDictionary subtract myDictionary as a sub-useDictionary () dictionary Set for myDictionary = CreateDictionary for every k in myDictionary.Keys MsgBox myDictionary (k) Next End Sub
Comments
Post a Comment