|
请大家帮我解决一下下面的问题.
我要新增一项资料,把新增资料中要用到的数据放在一个excel表中,然后在运行的时候导入该execl表。然后用一个循环分别读取excel表中的数据。为什么我运行的时候只能读取第一行的数据,后面的数据不能正确读取呢。研究了好久,估计是Browser("::::School Sports Programe").Page("::.SSP System.::").WebEdit("noOfRegister").Set DataTable("noOfRegister", dtsportCaptionSheet) 这地方有问题,但不知道怎么解决。
大伙帮我看看吧。
相关的代码copy如下:
datatable.AddSheet("sportCaption")
datatable.ImportSheet "E:\sportCaption.xls","sportCaption","sportCaption"
Dim i,rowcount
i=0
rowcount=datatable.GetSheet("sportCaption").getrowcount
reporter.ReportEvent 2,"there are "&rowcount,"row in this data table"
Do while i<rowcount
i=i+1
datatable.getsheet("sportCaption").setcurrentrow(i)
Browser("::::School Sports Programe").Page("::::School Sports Programe_2").Image("mnu01").Click
Browser("::::School Sports Programe").Page("::::School Sports Programe_2").WebButton("新增資料").Click
Browser("::::School Sports Programe").Page("::::School Sports Programe_2").WebButton("運動領袖").Click
Browser("::::School Sports Programe").Page("::.SSP System.::").WebList("activityType").Select DataTable("activityType", dtsportCaptionSheet)
Browser("::::School Sports Programe").Page("::.SSP System.::").WebList("activityName").Select DataTable("activityName", dtsportCaptionSheet)
Browser("::::School Sports Programe").Page("::.SSP System.::").WebEdit("startDateString").Set DataTable("startDateString", dtsportCaptionSheet)
Browser("::::School Sports Programe").Page("::.SSP System.::").WebEdit("endDateString").Set DataTable("endDateString", dtsportCaptionSheet)
Browser("::::School Sports Programe").Page("::.SSP System.::").WebEdit("activityDate1").Set DataTable("activityDate1", dtsportCaptionSheet)
Browser("::::School Sports Programe").Page("::.SSP System.::").WebEdit("time1").Set DataTable("time1", dtsportCaptionSheet)
Browser("::::School Sports Programe").Page("::.SSP System.::").WebEdit("noOfRegister").Set DataTable("noOfRegister", dtsportCaptionSheet)
Browser("::::School Sports Programe").Page("::.SSP System.::").WebEdit("venue").Set DataTable("venue", dtsportCaptionSheet)
Browser("::::School Sports Programe").Page("::.SSP System.::").WebEdit("status").Set DataTable("status", dtsportCaptionSheet)
Browser("::::School Sports Programe").Page("::.SSP System.::").WebEdit("remark").Set DataTable("remark", dtsportCaptionSheet)
Browser("::::School Sports Programe").Page("::.SSP System.::").WebButton("儲存").Click
Browser("::::School Sports Programe").Dialog("Microsoft Internet Explorer").WinButton("確定").Click
Browser("::::School Sports Programe").Dialog("Microsoft Internet Explorer").WinButton("確定").Click
Browser("::::School Sports Programe").Page("::.SSP System.::_2").WebEdit("applicationNo").Output CheckPoint("applicationNo_2")
Browser("::::School Sports Programe").Page("::.SSP System.::_2").WebEdit("fee").Output CheckPoint("fee")
'Browser("::::School Sports Programe").Page("::.SSP System.::_2").WebButton("更新資料").Check CheckPoint("更新資料_2")
Browser("::::School Sports Programe").Page("::.SSP System.::_2").WebButton("離開")
Loop |
|