I'm using VBA in an application called ProcessBook and I'm looking to store some static information in a dictionary.
I'm trying to initialize this dictionary cleanly and without needing to call a separate procedure, but none of the methods I try seem to be expected.
Here's what I've tried so far:
Dim myDict As New Dictionary(Of String, String) (("key1", "item1"), ("key2", "item2"))
Dim myDict As Variant
Set myDict = New Dictionary( ("key1", "item1"), ("key2", "item2") )
And basically a bunch of guessing involving forms like that.
So far the best I've been able to do is something like:
With myDict
.add "key1", "item1"
.add "key2", "item2"
End With
But this barks at me when it's not inside of a routine, which I'd like to avoid.
I believe the (Of type, type) From { } syntax is beyond VBA 6.5
Does anyone know of some clean ways to initialize a scripting.dictionary in VBA 6.5?
Dim var As Typesyntax, this is Office VBA code (which has been referred to as VB 6.5 by Microsoft in the past)