Access vba dictionary to array code example
Example: vba array to dictionary
Function ArrayToDictionary(pArray As Variant) As Dictionary
Set ArrayToDictionary = New Dictionary
Dim index As Long
For index = LBound(pArray) To UBound(pArray)
If Not ArrayToDictionary.Exists(pArray(index)) Then
ArrayToDictionary.add key:=pArray(index), item:=pArray(index)
End If
Next index
End Function
Sub TestMe()
Dim myDict As Dictionary, myArray As Variant
myArray = Array("a", "b", "c")
Set myDict = ArrayToDictionary(myArray)
Debug.Print myDict("a")
End Sub