excelvbadebuggingwatchscripting.dictionary

How to watch a "Scripting.Dictionary" of more than 256 elements in excel vba when adding a variable in the spy window?


I have a scripting dictionary of around 450 elements. I need for debugging to watch in the spy window elements at index > 256, but Excel VBA limits the view to index 256. What I want to debug is the lack of some keys and to track what happens when they are supposed to be created.

Here is the declaration: Set col = CreateObject("Scripting.Dictionary")

I would expect to be able to write something like I can in Python: col[256:512]

As a workaround, I can print all the keys in a debug terminal like explained here: For Each c In col: Debug.Print c: Next

Bus there a way to do what I want in the watch/spy window?


Solution

  • Add watch -> col.Items or col.keys as expressions.