|
根据LOVETEST6的说明作出一点修改!
改下例子除自己写的程序可以放到你们自己的脚本上面.其它都是QTP录制自带的例子可以得到的.
name
kkkk
llllll
ppppppp
eeeeee
我们将sheet1改名为Global
datatable.AddSheet("name")-----加一个SHEET
datatable.ImportSheet "C:\name.xls" ,1,Global------从外部导进4个数据
Dim i,rowcount '定义两个变量
i=0
rowcount=datatable.getrowcount
Do while i<rowcount
i=i+1
msgbox rowcount
reporter.ReportEvent 2,"统计NAME总行数 "&rowcount
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").WinObject("Date of Flight:").Type "062305"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Denver"
Window("Flight Reservation").WinComboBox("Fly To:").Select "London"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
datatable.setcurrentrow(i)
Window("Flight Reservation").WinEdit("Name:").Set DataTable("name", dtGlobalSheet)
Window("Flight Reservation").WinEdit("Tickets:").SetSelection 0,1
Window("Flight Reservation").WinEdit("Tickets:").Set "2"
Window("Flight Reservation").WinRadioButton("Business").Set
Window("Flight Reservation").WinButton("Insert Order").Click
loop
以上四行数据都可以依次取到! |
|