Property: Count for Dictionary
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Properties > Property: Count for Dictionary
Property: Count for Dictionary
Counts all key/element pairs from a Dictionary collection.
Object.Count
| Object | Dictionary Object with this property |
| Object.Count | LongInteger with read access |
The following example generates a Dictionary collection and adds some key/element pairs. Then the example displays the list of all keys:
Dim MyDic, MyKeys, sOutput, i Set MyDic = CreateObject("Scripting.Dictionary") Call MyDic.Add ("a", "Austin") Call MyDic.Add ("b", "Berlin") Call MyDic.Add ("c", "Chicago") MyKeys = MyDic.Keys For i = 0 to MyDic.Count-1 sOutput = sOutput & MyKeys(i) & VBCrLf Next Call MsgBox(sOutput)