Forum Discussion
HKosova
13 years agoSmartBear Alumni (Retired)
Hi Anil,
Take a closer look at the following part of your code:
Here, you reset the s variable to an empty string on each row iteration. That's why, it ends up only with last row data at the end of the loop. (You can see this if you step through the loop under a debugger.)
Your code should be as follows:
Actually, I would recommend integrating the AUT operations and the data reading loop, so that you don't have to do data join and split. For example, you could use something like this instead:
Above function is reading the excel file, but it is reading the last row
Take a closer look at the following part of your code:
For i = 1 to 4
s = ""
For j = 1 to 15
s = s + VarToString(Excel.Cells(i, j)) + "#"
Next
Next
Here, you reset the s variable to an empty string on each row iteration. That's why, it ends up only with last row data at the end of the loop. (You can see this if you step through the loop under a debugger.)
Your code should be as follows:
s = ""
For i = 1 to 4
For j = 1 to 15
s = s + VarToString(Excel.Cells(i, j)) + "#"
Next
Next
Actually, I would recommend integrating the AUT operations and the data reading loop, so that you don't have to do data join and split. For example, you could use something like this instead:
Sub createbudget
Dim Rightframe, Excel, i
Set Excel = Sys.OleObject("Excel.Application")
Call Excel.Workbooks.Open("E:\Budget.xlsx")
Delay 1000
Set Rightframe = sys.process.page("http//").document.rightframe
For i = 1 to 4
RightFrame.document.all.Item("ddlProj").ClickItem( VarToString(Excel.Cells(i, 1)) )
RightFrame.document.all.Item("ddlSubProj").ClickItem( VarToString(Excel.Cells(i, 2)) )
Next
' Closes the driver
Call Excel.ActiveWorkbook.Save
Call Excel.Workbooks.Close
End Sub
Related Content
Recent Discussions
Working with Visual Test
Solved2 days agoBypassing TC engine
Solved2 days ago