Showing No. of Pages in a cell
Rob
Sub Page_Nos()
TotalPages = ExecuteExcel4Macro("Get.Document(50)")
MsgBox "there are " & TotalPages & " pages in this print job"
Sheets("Sheet1").Range("A1").Value = TotalPages
End Sub
Alternative in Thisworkbook BeforePrint routine.........
Private Sub Workbook_BeforePrint(Cancel As Boolean)
TotalPages = ExecuteExcel4Macro("Get.Document(50)")
msg = "There will be " & TotalPages & " Printed Pages" & Chr(13) _
& "Is this acceptable?" & Chr(13) _
& "If Not, Hit No to Cancel Job"
Ans = MsgBox(msg, vbYesNo)
Select Case Ans
Case vbNo
Cancel = True
End Select
End Sub
Gord Dibben Excel MVP
On Wed, 21 Dec 2005 17:10:09 +1030, "Rob" wrote:
I've set up a workbook to print data with page breaks in various places.
The amount of the data can increase or decrease, either by sheer volume or
by filtering. I would like to notify the user the number of pages that will
be printed depending on the setup/filtering/volume of data, etc.
I realise there is the Option to have the total number of pages printed at
the bottom (or top)via the Footer (or header) facility in Page setup, but I
want to show this elsewhere.
Is there some way to do this?
Rob
|