I have a VBA function that should use a dictionary as an argument:
Function ShowDict(Dict1 As Dictionary)
For Each x In Dict1
MsgBox (Dict1.Item(x))
Next
End Function
And I'm trying to call it this way:
Dim Dict As Dictionary
Set Dict = Dictionary
Dict.Add "Owner", "John"
Dict.Add "Employee", "Sam"
ShowDict (Dict)
I selected the Microsoft Scripting References links from the links before the dictionary definition. However, I get a compilation error indicating "The argument is not optional " when I try to call a function using the "Dict" parameter as a parameter. Can anybody help me?
source
share