VBA有字典结构吗? [英] Does VBA have Dictionary Structure?

查看:262
本文介绍了VBA有字典结构吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VBA有字典结构吗?像关键的<>值数组?

解决方案



设置对MS脚本运行时'Microsoft Scripting Runtime')

  Set dict = CreateObject(Scripting.Dictionary)

  Dim dict As New Scripting .Dictionary 

使用示例:

 如果不是dict.Exists(key)然后
dict.Add key,value
End If

完成使用后,不要忘记将字典设置为 Nothing

  Set dict = Nothing 


Does VBA have dictionary structure? Like key<>value array?

解决方案

Yes.

Set a reference to MS Scripting runtime ('Microsoft Scripting Runtime')

Set dict = CreateObject("Scripting.Dictionary")

or

Dim dict As New Scripting.Dictionary 

Example of use:

If Not dict.Exists(key) Then 
    dict.Add key, value
End If 

Don't forget to set the dictionary to Nothing when you have finished using it.

Set dict = Nothing 

这篇关于VBA有字典结构吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆