在Access / Excel VBA中创build字典型结构?

我想要这样声明:

dictionaryItem = {("Key1", "Value1"}, {"Key2", "Value2"} ... } 

但不能正确的语法。 如果不是,我想用两个初始值的数组(但不pipe我怎么写它都无法得到这个工作)。

在我看来,你正在描述一个脚本字典。 看看这是否令人满意。

 Dim dct As Object Set dct = CreateObject("Scripting.Dictionary") dct.Add "Key1", "Value1" dct.Add "Key2", "Value2" Debug.Print dct.Count Debug.Print dct("Key1") Debug.Print dct("Key2") Set dct = Nothing