2

我想声明这样的东西:

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

但无法正确使用语法。如果不是,我想创建两个具有初始值的数组(但无论我如何尝试编写它都无法使其工作)。

4

1 回答 1

6

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

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
于 2012-06-05T14:24:34.850 回答