VBA脚本中如何遍历Dictionary对象

Dim dict

Set dict = CreateObject(“Scripting.Dictionary”)

‘第一种方法
k = dict.keys
v = dict.Items
For i = 0 To dict.Count – 1
key = k(i)
Value = v(i)
MsgBox key & Value
Next

‘第二种方法
Dim key

For Each key In dict.keys
msgbox dict(key)
Next

【版权说明:仅允许非商业转载且请注明出处:Mac私塾 网址:http://macsishu.com】

发表评论

邮箱地址不会被公开。