Micro Focus QTP (UFT) Forums
How to use the for loop while using Excel import to local datasheet? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to use the for loop while using Excel import to local datasheet? (/Thread-How-to-use-the-for-loop-while-using-Excel-import-to-local-datasheet)



How to use the for loop while using Excel import to local datasheet? - Uma - 09-30-2011

Hi,
In my Excel sheet The first row i am having heading,
2and 3 rd row I am having values.
I am importing this excel sheet to local data sheet.
My script is like this,
Code:
Set xlWrkbk = xlApp.Workbooks.Open("C:\ListMan.xls")
'Set xlWrksht= xlWrkbk.Worksheets("MyLi-Loc")
For iRow = 2 to xlWrkSht.UsedRange.Rows.Count
.......
Next

Really I dont want to open this Excel again and again,thatwhy,I started using import method.Eventhough import method works for me,for selecting all the rows I need to set up for loop and its relative objects...
So again I am using the following command which opens the Excel sheet.
Code:
Set xlWrkbk = xlApp.Workbooks.Open("C:\ListMan.xls").


How to use the Xl sheet rows with out opening the excel sheet?

Any help?
Thanks
uma


RE: How to use the for loop while using Excel import to local datasheet? - Uma - 09-30-2011

It is working using the following Script
Code:
For i = 1 to DataTable.GetRowCount
........
Next