Micro Focus QTP (UFT) Forums

Full Version: Excel used sheets
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi
i want to get the number of sheets used in excel.
can any one please help me in this regard


Can you loop thru all the sheet and find the usedrange.rows value for each sheet. if more than zero means u can increment the counter and get the desired from counter value
i don't know if there is a method to count no of sheets in an excel file but one trick is,
try to open a non existing sheet and get that err.Number
Then in your code use a loop to open all sheets one by one meanwhile keep incrementing a variable as no. of sheets till you get that same err.number