Method: RemoveAll for Dictionary
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Methods > Method: RemoveAll for Dictionary
Method: RemoveAll for Dictionary
Deletes all key/element pairs from a Dictionary collection.
Object.RemoveAll
| Object | Dictionary Object with this method |
The following example generates a Dictionary collection and adds some key/element pairs. Then the example deletes all pairs and displays the empty key-list:
Dim MyDic, MyKeys, MyKey, sOutput Set MyDic = CreateObject("Scripting.Dictionary") Call MyDic.Add ("a", "Austin") Call MyDic.Add ("b", "Berlin") Call MyDic.Add ("c", "Chicago") Call MyDic.RemoveAll MyKeys = MyDic.Keys For Each MyKey in MyKeys sOutput = sOutput & MyKey & VBCrLf Next Call MsgBox(sOutput)