![]() |
Page Number in cell
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 |
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 |
Page Number in cell
Is there a way to do this, but instead of referencing total pages, to
reference the page number of a specific page/sheet from the work book (so say I switch the position of the sheet from the last page to the third page, how to I make sure that the cell will track that change). Ben "Gord Dibben" wrote: 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 |
Page Number in cell
None that I know of but hang around.
One of the more knowledgeable types may come up with something. Gord On Wed, 16 Jul 2008 13:18:16 -0700, Ben Langhammer <Ben wrote: Is there a way to do this, but instead of referencing total pages, to reference the page number of a specific page/sheet from the work book (so say I switch the position of the sheet from the last page to the third page, how to I make sure that the cell will track that change). Ben "Gord Dibben" wrote: 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 |
All times are GMT +1. The time now is 03:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com