View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default Putting Page Number in last page text

I'm not sure if this will help you but to get the number of pages that will
print with the current page setup you can use this code:

Pages = Application.ExecuteExcel4Macro("get.document(50)")

--
Jim
"DRK" wrote in message
...
|I have a workbook which uses a print macro. The printout is for several
| worksheets which have variable ranges or even entire pages being
| included/excluded based on Booleans.
|
| On the last page of the printout I need to include the page number for the
| last page before this legal notice and then subtract 2 and then include
that
| value on the last page of the legal notice (which is fixed at 2 pages in
| length).
|
| For example - my printout takes 20 pages before I get to the legal notice.
I
| have to capture that value of 20 and put it in a footnote on page 22 that
| reads "The attached document totals 20 pages excluding this
acknowledgment."
| --
| DRK