Private Sub CommandButton1_Click() Dim d2 As Scripting.Dictionary Dim i As Integer Set d2 = New Scripting.Dictionary d2.Add 1,"11111" d2.Add 2,"22222" d2.Add 3,"33333" For i = 0 To d2.Count - 1 MsgBox d2.item(i + 1) Next i MsgBox "OK" End Sub原文链接:https://www.f2er.com/vb/260215.html