scripting.dictionaryについて
VBAで用いられるオブジェクト
例
Dim dict As Object
Set dict = CreateObject("Scripting.Dictionary")
' 値の追加
dict.Add "名前", "太郎"
dict.Add "年齢", 30
' 値の取得
MsgBox dict("名前") ' 太郎 と表示される
' 値の変更
dict("年齢") = 31
' キーの存在チェック
If dict.Exists("名前") Then
MsgBox "名前があります"
End If
' キーの削除
dict.Remove "年齢"
' 全件ループ(キーと値を出力)
Dim key As Variant
For Each key In dict.Keys
Debug.Print key & ":" & dict(key)
Next
連想配列としてキーと値のペアを扱うオブジェクト
Pythonでいうdict、JavaScriptでいう、{}。