total no of excel sheet

B

balakumar

i am using visual basic 6.0. i need to know total no of
excel sheet avaiable in one excel file thru vb
program.how to do that?

Thanks
balakumar
 
T

Tom Ogilvy

xlApp.ActiveWorkbook.Sheets.count

or for worksheets

xlApp.ActiveWorkbook.Worksheets.count
 
B

Bill Barclift

Sheets can include both Charts and Worksheets.

For both charts and Worksheets (includeing Excel4 macro sheets)

xlApp.ActiveWorkbook.Sheets.count

For Charts only:

xlApp.ActiveWorkbook.charts.count

For Worksheets only:

xlApp.ActiveWorkbook.Worksheets.count


Bill Barclift
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top