一.用函数实现下拉框检查数值:
Vbs中函数有Sub 与Function ,区别是Sub没有返回值,Function有
Set fly =Window("Flight Reservation").WinComboBox("Fly From:")
Function flyCom(obj)
Dim myArr()
For i = 0 to obj.GetItemsCount -1
ReDim Preserve myArr(i)
myArr(i)= obj.GetItem(i)
Next
flyCom=myArr
End Function
调用该函数,把函数赋值给变量aa,因该函数返回值是数组类型,直接用ubound求出数组大小
aa =flyCom(fly)
for i= 0 to ubound(aa)
msgbox aa(i)
Next