I am importing the data from the excel sheet for input and using for loop to put in the different values but at the end of the data in excel it starts again.How can I make it stop from going into the infinite FOR loop.Code is as following
Code:
datatable.Import("C:\Path")
rowcount=DataTable.GetRowCount
For r=1 to rowcount
DataTable.SetCurrentRow( r )
systemutil.Run"C:\Program Files (x86)\Internet Explorer\iexplore.exe"
Browser("Browser").WinEdit("Edit").Set "URL"
Browser("Browser").WinToolbar("Page Control").Click(button)
Browser("Browser").Page("AWB - Current Status").WebEdit("airWayBillTrackingNo").Set DataTable("AWBno", dtGlobalSheet)
Browser("Browser").Page("AWB - Current Status").WebButton("Track").Click(button)
'Browser("Browser").Sync
'-----a = Browser("Browser").Page("AWB - Current Status").Check (CheckPoint("AWB - Current Status_2"))
'---------msgbox("The Error for blank AWB : " & a)
'------Browser("Browser").Sync
'-------Browser("Browser").Page("AWB - Current Status_2").Link("Modify Search").Click
'---------b= Browser("AWB - Current Status").Page("AWB - Current Status").Check (CheckPoint("AWB - Current Status"))
'----------msgbox("The Error for AWB not found or only numbers : "& b)
'TODO:Check
strText=Browser("Browser").Page("AWB - Current Status").WebElement("AWB").GetROProperty("innertext")
strText1=Browser("Browser").Page("AWB - Current Status").WebElement("AWBO").GetROProperty("innertext")
strText2=Browser("Browser").Page("AWB - Current Status").WebElement("AWBD").GetROProperty("innertext")
strText3=Browser("Browser").Page("AWB - Current Status").WebElement("FlightD").GetROProperty("innertext")
strText4=Browser("Browser").Page("AWB - Current Status").WebElement("FlightDate").GetROProperty("innertext")
strText5=Browser("Browser").Page("AWB - Current Status").WebElement("Flightno").GetROProperty("innertext")
strText6=Browser("Browser").Page("AWB - Current Status").WebElement("FlightO").GetROProperty("innertext")
strText7=Browser("Browser").Page("AWB - Current Status").WebElement("FlightTime").GetROProperty("innertext")
strText8=Browser("Browser").Page("AWB - Current Status").WebElement("CurrentStatus").GetROProperty("innertext")
'Create Excel app
Set objAppExcel=CreateObject("Excel.Application")
objAppExcel.visible=True
'Open the worksbook
objAppExcel.workbooks.open "C:\Users\User\Desktop\TRACK.xls"
'Set focus on the workbook
objAppExcel.Workbooks("TRACK.xls").Activate
'Create work sheet obj
Set objExcelSheet=objAppExcel.ActiveWorkbook.Worksheets(1)
'Write to work sheet
'Save worksheet
'objExcelSheet.saveAs "C:\Users\User\Desktop\TRACK.xls"
'Clear obj reference
'----Set objExcelSheet=Nothing
'quit app
'----objAppExcel.quit
'-----Set objAppExcel=Nothing
'Write to work sheet
objExcelSheet.cells(1,1)=strText
objExcelSheet.cells(1,2)=strText1
objExcelSheet.cells(1,3)=strText2
objExcelSheet.cells(1,4)=strText3
objExcelSheet.cells(1,5)=strText4
objExcelSheet.cells(1,6)=strText5
objExcelSheet.cells(1,7)=strText6
objExcelSheet.cells(1,8)=strText7
objExcelSheet.cells(1,9)=strText8
'Save worksheet
objExcelSheet.saveAs "C:\Users\User\Desktop\TRACK.xls"
'Clear obj reference
Set objExcelSheet=Nothing
'quit app
objAppExcel.quit
Set objAppExcel=Nothing
Browser("Browser").Close
Next