VBA_Excel_教程:字典类型
2016-12-03 12:38
281 查看
VBA中的字典类型需要添加Microsoft Scripting Runtime引用,在Tools菜单下添加
Sub testDic() Dim strV As String Dim key As String key = "name" Dim value As String value = "关羽" Dim dic As Object Set dic = CreateObject("Scripting.Dictionary") '增 If dic.exists(key) = False Then dic.Add key, value End If Call read(dic) '删1 dic.Remove (key) Call read(dic) '删2:移除全部内容 ' dic.RemoveAll Call read(dic) End Sub Sub read(dic As Object) '遍历读取 For Each k In dic strV = dic.Item(k) Debug.Print strV Next End Sub
相关文章推荐
- Excel VBA练习:字典类型与正则表达式的使用
- Excel_VBA_编程教程(完整版)、开发环境、实例、函数大全、SVN、linux及shell学习
- Excel VBA - 自定义数据类型及其它
- VBA_Excel_教程:过程,函数
- Excel_VBA开发2048游戏教程——Einsphoton
- VBA遍历当前目录下指定类型的excel文件并复制文件内指定的内容到新表中
- Excel中的VBA常量和编码值所代表的标准图表类型
- VBA_Excel_教程:表,格
- VBA_Excel_教程:变量,数组
- 简明python教程 --C++程序员的视角(四):容器类型(字符串、元组、列表、字典)和参考
- Excel_VBA_编程教程(完整版)
- Python中字典映射类型的学习教程
- VBA_Excel_教程:分枝循环结构
- EXCEL 宏 拆分数据表 VBA 视频教程下载
- Excel中的VBA常量和编码值所代表的标准图表类型
- Python中字典映射类型的学习教程
- 简明python教程 --C++程序员的视角(四):容器类型(字符串、元组、列表、字典)和参考
- VBA_Excel_教程:单元格颜色
- Excel VBA 字典/数组 示例
- VBA_Excel_教程:Option,错误处理