VBA Dictionary Data Type

The solution for “VBA Dictionary Data Type” can be found here. The following code will assist you in solving the problem.

Sub DictionaryBasicSetup()
‘ (1) set up the VBA dictionary object (Tools > References > Microsoft Scripting Runtime)
‘ (2) insert two random values in the dictionary
‘ (3) print the values to the immediate window be referencing the keys
Dim dict As Scripting.Dictionary

Set dict = New Scripting.Dictionary

‘ insert some random items
dict(“Alice”) = “555-778-0131”
dict(“Bob”) = “555-202-0114”

‘ print items to the immediate window
Debug.Print dict(“Alice”)
Debug.Print dict(“Bob”)

End Sub

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts