Count number of rows in Excel without opening it.

‘Following code demonstrate how to count number of rows in Excel without opening it – using vbscipt in QTP.
Set objExcel=CreateObject(“Excel.Application”)
Set objWB=objExcel.WorkBooks.Open(“C:abc.xls”)
Set objSheet=objWB.WorkSheets(1)
msgbox objSheet.usedrange.rows.count
Set objExcel=Nothing

3 thoughts on “Count number of rows in Excel without opening it.”

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top