Link to home
Start Free TrialLog in
Avatar of tmonteit
tmonteitFlag for Afghanistan

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?
Avatar of amit_g
amit_g
Flag of United States of America image

For Each Key In DictionaryObject
  Debug.Print "Key=" & Key  & " Value=" & DictionaryObject.Item(Key)
Next
ASKER CERTIFIED SOLUTION
Avatar of zorvek (Kevin Jones)
zorvek (Kevin Jones)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tmonteit

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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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 :)