Method: Items for Dictionary
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Methods > Method: Items for Dictionary
Method: Items for Dictionary
Returns an array with the elements from a Dictionary collection.
vItems = Object.Items
| Object | Dictionary Object with this method |
| vItems | Variant Receives the array with the elements. |
The following example generates a Dictionary collection and adds some key/element pairs. Then the example displays the list of all elements:
Dim MyDic, MyItems, MyItem, sOutput Set MyDic = CreateObject("Scripting.Dictionary") Call MyDic.Add("a", "Austin") Call MyDic.Add("b", "Berlin") Call MyDic.Add("c", "Chicago") MyItems = MyDic.Items For Each MyItem in MyItems sOutput = sOutput & MyItem & VBCrLf Next Call MsgBox(sOutput)