UFT_基础14_动态数组重构excel,字典
来源:互联网 发布:淘宝网棉拖鞋批发 编辑:程序博客网 时间:2024/06/06 19:26
字典 Scripting.Dictionary
1、CreateObject(“Scripting.Dictionary”)
(1)Add
(2)Remove
//定义一个字典Set objDic = CreateObject("Scripting.Dictionary")objDic.Add "1","aa"objDic.Add "2","bb"objDic.Add "3","cc"objDic.Add "4","dd"//移除一个objDic.Remove("3")//显示字典个数msgbox objDic.Count//字典中所有key组成一个数组,下标从0开始key = objDic.Keys//显示数组key中第2个元素,值为2msgbox key(1)//根据key值获取字典中的数据value=objDic.Item("1")msgbox value----------//动态数组Dim Arr()For i = 1 To 3 ReDim preserve arr(i-1) arr(i-1)=iNextmsgbox ubound(Arr)msgbox Arr(1)----------//excel表格'Set ExcelApp=CreateObject("Excel.Application")'Set ExcelPath=ExcelApp.Workbooks.Open("D:\UFT\data.xlsx")'Set ExcelSheet=ExcelPath.Worksheets("Sheet1").UsedRange'rowCount=ExcelSheet.Rows.count'columnCount=ExcelSheet.Columns.count'ExcelPath.Close'ExcelApp.Quit'set ExcelApp = Nothing----------//excelFunction excel(path,sheet) Dim Arr() Set ExcelApp=CreateObject("Excel.Application") Set ExcelPath=ExcelApp.Workbooks.Open(path) Set ExcelSheet=ExcelPath.Worksheets(sheet).UsedRange rowCount=ExcelSheet.Rows.count columnCount=ExcelSheet.Columns.count For i = 1 To rowCount ReDim preserve Arr(i-1) Arr(i-1)=ExcelSheet.cells(i,1) Next Set ExcelSheet=NOthing ExcelPath.Close ExcelApp.Quit set ExcelApp = Nothing excel =ArrEnd Function----------//调用函数excelb = excel("D:\UFT\data.xlsx","sheet1")msgbox ubound (b)msgbox b(0)For i = 1 To ubound(b) msgbox b(i)NextSet fromCity =Wpfwindow("HPE MyFlight Sample Applicatio").WpfComboBox("fromCity")For i = 0 To fromCity.GetItemsCount -1 If fromCity.GetItem(i)=b(i) Then print i& " is right" else print i& " is wrong" End IfNext
阅读全文
0 0
- UFT_基础14_动态数组重构excel,字典
- UFT_基础_描述性编程_测试报告_重构下拉框_打开应用程序
- UFT_基础_GetROProperty_SetTOProperty_GetROProperty详解
- Swift基础语法&&入门教程_字符串,数组_字典
- UFT基础_16作业讲解-切割字符串以及字典重构excel
- 集合_数组_字典
- OC基础_字典
- JavaScript 基础(003_数组去重)
- 数组,字典基础整理
- Excel VBA 字典/数组 示例
- Swift_array _数组_字典_Character_String
- 动态数组去重
- swift基础4-数组、字典
- OC基础:数组.字典.集
- Java基础_数组
- Java基础_数组
- Java基础_数组
- OC基础_数组
- mvn build 遇到的错误
- XML_pull解析
- CSS(二)
- php中array转为json时的对象和数组的对应关系
- Apache
- UFT_基础14_动态数组重构excel,字典
- nyoj 括号配对问题(stack的使用)
- 当construct 2遇上umaru
- Templates 的使用
- System V 与 POSIX
- win10系统不重装系统启动AHCI
- 使用UInput模拟系统键盘鼠标动作
- sys.argv[] 用法
- latex正下