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?

setDictionary () as the dictionary set aDictionary = new dictionary with aDictionary. Add key: = "key1", item: = "value1". Add the key: = "key2", item: = CreateDictionary = "A2" with a "value2" end, the authonization function sub-useDictionary () myDictionary = CreateDictionary myDictionary.Keys MsgBox myDictionary.k next key for every K sub
"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

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -