MrExcel Publishing
Your One Stop for Excel Tips & Solutions

How to read # of total pages in Excel Worksheet?

Posted by Anatoly on May 26, 2000 2:07 PM

I'm writing a VB program that will open Excel Workbook and it will go through worksheets and determine number of pages each worksheet contains. I know how to open Excel, but have a difficulty with second part.
Can someone point me to the right direction?

Posted by Ivan Moala on May 26, 2000 2:34 PM

If you mean getting each sheets # of pages to print
Then use an excel4 command.
This gets the total number of pages that would be printed based on current settings, excluding notes, or 1 if the document is a chart.


Posted by Celia on May 26, 2000 2:39 PM


MsgBox Application.ExecuteExcel4Macro("GET.DOCUMENT(50,""" & ActiveSheet.Name & """)")


Posted by Anatoly on May 30, 2000 10:26 AM

Thank you, that is exactly what I need.