Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Capture Total Page Count prior to Printing?

Status
Not open for further replies.

blazingfury

Programmer
Oct 17, 2003
3
US
Within an Excel macro (which allows users to print multiple versions of the active spreadsheet), I'm needing to validate that the total page count to be printed (per separate print version) hasn't been altered due to a user adjusting a column width, thereby doubling the printed page count. The information I'm wanting to capture would be what is displayed in the bottom left corner within the Print Preview (example-> "Preview: Page 1 of 8"; I'm needing to capture 8). Page breaks are not manually set within the worksheets, so I cannot base the count on VPageBreaks. Alternately, I could base my logic on knowing if all columns, in current format, will print on a single page, regardless of number of rows. Any suggestions?
 
Thanks for the reply Skip!

Your suggestion would work, & I'll use it if no other suitable alternative is mentioned, but my intent is not to adjust the user worksheet configuration, just to filter the print macro to only allow the macro to complete if the worksheet hasn't been adjusted too wide. Primarily due to the amount of data on each sheet is intense & set to a very small enough font as is, & as these sheets may be faxed, it could end up unreadable.

Thanks!
 
If it's just the Number of Pages the current set-up will print then;

Code:
Sub NoOfpagesToPrint()

MsgBox ExecuteExcel4Macro("GET.DOCUMENT(50)")

End Sub
 
Ivan,

Excellent! Thanks a bunch for such a simple solution!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top