问题
the title explains my problem. Im working on an excelmakro and my questions is, is there an option that the debugger shows all elements like it does with an array?
And if not, is the only workaround the storage of my classobjects in an array after inflating the collection?
I appreciate your help.
回答1:
You could use debug.print
and write the output into the immediate window and bypass the limit that way.
I am almost certain that there is no way to increase that limit, but maybe someone else can give a def. answer on that.
回答2:
The answer seems to be no -- but the following sub might help. A simple experiment shows that it can be used in the immediate window while in debug mode:
Sub display(col As Collection)
Dim i As Long
Dim it As Variant
Dim itType As String
For i = 1 To col.Count
it = col.Item(i)
itType = TypeName(it)
Debug.Print "Item " & i & " -- Value: " & it & " -- Type: " & itType
Next i
End Sub
回答3:
In my case the elements of the collection could be arrays.
John Coleman's sub could be improved to cover (at least one-dimensional) arrays as:
Sub display(col As Collection)
Dim i As Long
Dim it As Variant
Dim itType As String
For i = 1 To col.Count
it = col.item(i)
itType = TypeName(it)
If Not IsArray(it) Then
Debug.Print "Item " & i & " -- Value: " & it & " -- Type: " & itType
Else
Debug.Print "Item " & i & " -- Values: [" & Join(it, ", ") & "] -- Type: " & itType
End If
Next i
End Sub
来源:https://stackoverflow.com/questions/30867105/vba-debugger-shows-only-256-elements-of-a-collection