Home |
Search |
Today's Posts |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On May 23, 12:12*pm, Gord Dibben wrote:
OK for printing worksheet at a time but as soon as you introduce the statement ActiveWorkbook.PrintOut, you have abandoned the sheet by sheet printing. I am quite sure that printing an entire workbook to a single *PDF file will not respect your page numbering. Gord On Mon, 23 May 2011 02:30:58 -0700 (PDT), F J wrote: Hi, Gord, thank you for your response. *Your macro worked great! :) Just as a follow up question, though, I tried to modify the code a bit so that if I had to print to PDF instead of to a printer, it wouldn't print a separate file for each sheet but would still start each sheet with page 1 and give the correct page total for each sheet. *The problem I'm running into now is that although I can get it so that each sheet starts with page 1, the page totals for each sheet are not correct. *It still gives the total number of pages in the entire workbook, not the total number of pages for each sheet. *Is there any way to do this? *Below is the code as I modified it. *Thank you in advance for any information. Sub test() * *Dim ws As Worksheet * *For Each ws In ActiveWorkbook.Worksheets * * * *ws.PageSetup.CenterHeader = "Page &P of &N" * * * *With ActiveSheet.PageSetup * * * *.FirstPageNumber = 1 * * * *End With * * Next ws * *ActiveWorkbook.PrintOut Copies:=1, preview:=False End Sub- Hide quoted text - - Show quoted text - Hi, Gord, yes, it works for one worksheet at a time but not for the whole workbook. I guess maybe there isn't a way to do it when printing to PDF. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I apply print area and page setup to entire workbook? | Excel Discussion (Misc queries) | |||
How to print entire workbook 9 pages to a sheet? | Excel Worksheet Functions | |||
Macro to open print window and set to print entire workbook | Excel Discussion (Misc queries) | |||
How do you format a sheet to fill the entire page to print? | Excel Discussion (Misc queries) | |||
How can I print page 2 of each sheet in a workbook? | Excel Discussion (Misc queries) |