09-10-2011, 03:18 AM
Hi,
I am opening a excel sheet from QTP.
This is my following code.
In the for loop I am asking to check the rows in the sheet
For
It checks all the 4 rows and it displays the correct result.
If it work with the 2nd and 3rd sheet it doesnot work properly.
It checks all the rows and again it tries to get inside and
giving invalid procedure call or argument error.
How to solve it?Any idea?
Thanks,
Uma
I am opening a excel sheet from QTP.
This is my following code.
Code:
Set xlWrkbk = xlApp.Workbooks.Open("C:\New Folder\RETS.xls")
Set xlWrksht = xlWrkbk.Worksheets("MD")
Set xlWrksht1 = xlWrkbk.Worksheets("Obj")
Set xlWrksht2 = xlWrkbk.Worksheets("Sea")
'Metadat is the name of the Excel sheet
intStartRow=1
'Declare the starting row
For intRow = intStartRow to xlWrksht.UsedRange.Rows.Count
Gmd= xlWrksht.Range("A" & intRow)
ID = xlWrksht.Range("B" & intRow)
Format = xlWrksht.Range("C" & intRow)
Res= xlWrksht1.Range("A" & intRow)
Type1 = xlWrksht1.Range("B" & intRow)
ID1= xlWrksht1.Range("C" & intRow)
...............
Next
For
Code:
intRow = intStartRow to xlWrksht.UsedRange.Rows.Count
It checks all the 4 rows and it displays the correct result.
If it work with the 2nd and 3rd sheet it doesnot work properly.
It checks all the rows and again it tries to get inside and
giving invalid procedure call or argument error.
How to solve it?Any idea?
Thanks,
Uma