Method: Add for Dictionary
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Methods > Method: Add for Dictionary
Method: Add for Dictionary
Adds a new key/element pair to a Dictionary collection.
Object.Add(Key, Item)
| Object | Dictionary Object with this method |
| Key | Variant Specifies the key. |
| Item | Variant Specifies the element. |
The following example generates a Dictionary collection and adds some key/element pairs:
Dim MyDic Set MyDic = CreateObject("Scripting.Dictionary") Call MyDic.Add ("a", "Austin") Call MyDic.Add ("b", "Berlin") Call MyDic.Add ("c", "Chicago")