Page Number in cell
Sub Pages_In_Cell()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
ActiveSheet.Range("G11") = TotPages
ActiveSheet.PrintOut
End Sub
Or event code in Thisworkbook module.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
ActiveSheet.Range("G11") = TotPages
ActiveSheet.PrintOut
End Sub
Gord Dibben MS Excel MVP
On Sun, 7 Oct 2007 13:16:04 -0700, Marilyn
wrote:
Hello I created a purchase order template. I need to show the number of
pages of the purchase order, but not in a header or footer.
Example Cell F10 is " No. Pages" (means the no of pages for the purchase
order) cell G11 should automatically populate number of pages ( 2, 3 or
how many papges there are for the order.)
How can I do this? thanks
|