i think u r not incrementing the counter of row number. Try this.. but dont increment column value
suppose col1 contains user name and col2 contains password
-------------------------------------------
You can also import your excel into QTP and then iterate. also you need to do some setting in options. Check the file attached.
----------------
To get a value form excel file..
To run the script for all the iterations..
suppose col1 contains user name and col2 contains password
-------------------------------------------
Code:
dim sExcelObj
dim sWorkBook
dim sWorkSheets
dim sValue
set sExcelObj = CreateObject("Excel.Application")
sExcelObj.Visible = true
set sWorkBook = sExcelObj.Workbooks.Open ("path of file")
set sWorkSheets = sWorkBook.ActiveWorkbook.worksheets ("sheetname")
username = sWorkSheets.cells(row,col1).value
password= sWorkSheets.cells(row,col2).value
row=row+1
You can also import your excel into QTP and then iterate. also you need to do some setting in options. Check the file attached.
----------------
Code:
datatable.importsheet "c:\excelfile.xls", "sheet1"
To get a value form excel file..
Code:
Empno = datatable.value("empno", "sheet1")
To run the script for all the iterations..
Code:
For i = 1 to datatable.getsheet("sheet1").getrowcount
msgbox datatable.value("empno", "sheet1")
Next