tmonteit
asked on
VBA Excel Question
I have a small script in Excel VBA and I'm using a Dictionary object.
I want to print all they key-value pairs how do I do this?
Debug.Print "Key=" & ??? & " Value=" & ???
Short example?
I want to print all they key-value pairs how do I do this?
Debug.Print "Key=" & ??? & " Value=" & ???
Short example?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dim dict As Dictionary
Set dict = New Dictionary
With dict
'set compare mode
.CompareMode = BinaryCompare
' Add items to the dictionary.
.Add "foo 1", "bar 1"
.Add "foo 2", "bar 2"
.Add "foo 3", "bar 3"
End With
For Each Item In dict.Items
Debug.Print Item
' ?? now what ??
Next
Set dict = New Dictionary
With dict
'set compare mode
.CompareMode = BinaryCompare
' Add items to the dictionary.
.Add "foo 1", "bar 1"
.Add "foo 2", "bar 2"
.Add "foo 3", "bar 3"
End With
For Each Item In dict.Items
Debug.Print Item
' ?? now what ??
Next
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sorry zv, I think you've answered it. didn't see your post before i hit send.
Could I ask why you did not consider http:#19577665 or if there was something wrong in it, I would like to know :)
Debug.Print "Key=" & Key & " Value=" & DictionaryObject.Item(Key)
Next