Declaring

Typically collections are declared as module or global variables.
Always put the declaration on one line and the assignment on a different line.
You need to add a project reference to the Microsoft Scripting Runtime library. This uses early binding

Dim dicFSODictionary As Scripting.Dictionary 
Set dicFSODictionary = New Scripting.Dictionary

Using the Set keyword allows you to create the collection exactly when you need it.
It allows you to test if the collection is Nothing.

If (dicFSODictionary Is Nothing) Then 
End If

Using Late Binding

It is possible to use this Scripting Library without adding a project reference by using late binding although this is not recommended.

Dim dicFSODictionary As Object 
Set dicFSODictionary = CreateObject("Scripting.Dictionary")

Passing Dictionarys In



Passing Dictionarys Out



© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext