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
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