0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

イミディエイトウィンドウでdictionaryのデバッグプリントを行う

Last updated at Posted at 2015-10-18

ウォッチ式からdictionaryの中身が見辛かったため作りました。
タブ区切りで出力されるのである程度見やすくしています。

printoptionを適当に指定するとdictionaryのkeyとitemの文字数を表示してくれます。
(printoptionがvariantなのはIsMissingを使うため)

Public Sub printDic(ByVal dic As Dictionary, Optional ByVal printoption As Variant)
    Dim i As Long
    
    If IsMissing(printoption) = True Then
        Debug.Print "Index"; Tab; "Keys"; Tab; "Items"
    Else
        Debug.Print "Index"; Tab; "Keys"; Tab; "Keys_Size"; Tab; "Items"; Tab; "Items_Size"
    End If
    For i = 0 To dic.Count - 1
        If IsMissing(printoption) = True Then
            Debug.Print i + 1; Tab; dic.Keys(i); Tab; dic.Items(i)
        Else
            Debug.Print i + 1; Tab; dic.Keys(i); Tab; Len(dic.Keys(i)); Tab; dic.Items(i); Tab; Len(dic.Items(i))
        End If
    Next i
End Sub
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?