怎么在datatable达到我想要的循环??
以下是FLIGHT上录制的脚本For i=1 to 3
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").ActiveX("MaskEdBox").Type "090909"
Window("Flight Reservation").WinComboBox("Fly From:").Select DataTable("p_Item", dtLocalSheet)
datatable.LocalSheet.setnextrow
For j=1 to 3
Window("Flight Reservation").WinComboBox("Fly To:").Select DataTable("p_Item1", dtLocalSheet)
datatable.LocalSheet.setnextrow
Next
Next
1
我希望的循环是
london->denverfrn->port london->paris fran->denfran->port fran->parisseattle->denversea->port sea->paris 3*3
而上面的代码实际上运行的是london->denverfrn->port london->paris fran->port fran->paris sea->paris 3*2
怎么样代码才能达到我希望的循环??
上面有段写错了。我这修改下
我希望的循环是
london->denver lond->port london->paris fran->den fran->port fran->paris seattle->denversea->port sea->paris
而上面的代码实际上运行的是london->denver lon->port london->paris fran->port fran->paris sea->paris 我知道了
因为 datatable.LocalSheet.setnextrow
你执行了两遍 删掉第一个就可以了 Dim tempa,tempb
Dim gj
For i=1 to 3
tempa =DataTable("AA", dtLocalSheet)
For j=1 to 3
tempb =DataTable("BB", dtLocalSheet)
msgbox "Tempa ->" & tempa & "Tempb ->" & tempb
gj = j
datatable.LocalSheet.setnextrow
Next
If gj = 3 Then
datatable.LocalSheet.setnextrow
End If
Next
上面这个代码可以实现你的要求,确认过了 Dim tempa,tempb
For i=1 to 3
DataTable.GetSheet("Action1").setcurrentrow(i)
tempa =DataTable("Flyfrom", dtLocalSheet)
For j=1 to 3
DataTable.GetSheet("Action1").setcurrentrow(j)
tempb =DataTable("Flyto", dtLocalSheet)
msgbox Tempa&" ->" & tempb &vbCRLF
Next
Next 谢谢各位了。问题已经决绝了
页:
[1]