|
6#
楼主 |
发表于 2010-3-31 11:15:22
|
只看该作者
还是怪我看书不仔细,ReadExcelCell 这个函数的语句没有加上,我晕,
完整的代码如下,已经调试通过
Public Function ReadExcelCell (pathway,sheetname,x,y)
Dim srcData,srcDoc,ret
Set srcData = CreateObject("Excel.Application")
srcData.Visible=false
Set srcDoc= srcData.Workbooks.Open(pathway)
srcDoc.Worksheets(sheetname).Activate
ret = srcDoc.Worksheets(sheetname).Cells(x,y).value
srcData.Workbooks.Close
ReadExcelCell = ret
Set srcData = Nothing
Set srcDoc = Nothing
End Function
For i=1 to 2
InvokeApplication "D:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").WinEdit("Agent Name:").Set ReadExcelCell("d:\test.xls","sheet1",i,1)
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").Set ReadExcelCell("d:\test.xls","sheet1",i,2)
Dialog("Login").WinEdit("Password:").Type micReturn
Dialog("Login").Close
Next |
|