I am using vba and have written certain values into the dictionary. However, I would like to see if information has been passed into the dictionary correctly. Hence, is it possible to debug.print keys and values in a dictionary to the immediate window?
I was thinking of this:
debug.print DicTemp.Items
Thank you!
Public Sub TestMe()
Dim dict As Object
Set dict = CreateObject("Scripting.Dictionary")
dict.Add "first", 30
dict.Add "second", 40
dict.Add "third", 100
Dim key As Variant
For Each key In dict.Keys
Debug.Print key, dict(key)
Next key
End Sub
It prints:
first 30
second 40
third 100
Loop through each dictionary key, and debug print:
Dim key As Variant
For Each key In dict.Keys
Debug.Print key, dict(key)
Next key
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With