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 oDict As Scripting.Dictionary 
Set oDict = 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 (oDict 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 oDict As Object 
Set oDict = CreateObject("Scripting.Dictionary")

Passing Dictionarys In



Passing Dictionarys Out



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