Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想声明这样的东西:
dictionaryItem = {("Key1", "Value1"}, {"Key2", "Value2"} ... }
但无法正确使用语法。如果不是,我想创建两个具有初始值的数组(但无论我如何尝试编写它都无法使其工作)。
在我看来,您正在描述一个脚本字典。看看这是否令人满意。
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