这可能会对您有所帮助或使您更加困惑。:)
你只需要参考字典上的键即可。
Dict1(Key1)(Key2).Add Key4, item4
这与
Dict1.Item(Key1).Item(Key2).Add Key4, item4
自从
Item
是默认成员。
Sub T()
Dim m1 As Scripting.Dictionary, m2 As Scripting.Dictionary, m3 As Scripting.Dictionary
Dim v1 As Variant, v2 As Variant, v3 As Variant
Set m1 = New Scripting.Dictionary
Set m2 = New Scripting.Dictionary
Set m3 = New Scripting.Dictionary
m3.Add "Three", "A" 'add A
m2.Add "Two", m3
m1.Add "One", m2
m1("One")("Two").Add "Four", "B" 'add B
m1("One")("Two").Add "Five", "C" 'add C
For Each v1 In m1.Keys
For Each v2 In m1(v1).Keys
For Each v3 In m1(v1)(v2).Keys
Debug.Print m1(v1)(v2)(v3)
Next v3
Next v2
Next v1
End Sub
'A
'B
'C