在 VBA 中查找字典对象的大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2646599/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 10:23:34  来源:igfitidea点击:

Find size of dictionary object in VBA

vbadictionarysize

提问by Gershwyn

What is the simplest way in VBA to determine the size (i.e., number of keys) in a dictionary object?

VBA 中确定字典对象大小(即键数)的最简单方法是什么?

回答by Alex K.

As in a Scripting.Dictionary? just use its .Countproperty.

如在Scripting.Dictionary? 只需使用它的.Count属性。

回答by Z. Khullah

For the number of keys (not items) you should use .Keysproperty, via UBound(Dictionary.Keys)since its an array

对于键(不是项目)的数量,您应该使用.Keys属性,UBound(Dictionary.Keys)因为它是一个数组