Hi, I need a VBA code to set the print preferences for all the worksheets in my workbook (in Personal) to narrow margins, landscape and A3.......hopefully with one sub to do all the sheets at once. Cheers.
How to set printing preferences
-
cobber1418 -
November 23, 2019 at 6:22 AM -
Thread is marked as Resolved.
-
-
-
Hi,
Have you turned on your macro recorder ... and done your printing process once ...
in order to collect all your specific requirements ...?
-
Hi, I think I have it compacted down to this.....but how can I do it for all sheets, or do I have to do each sheet individually?
Code
Display MoreWith ActiveSheet.PageSetup .LeftMargin = Application.InchesToPoints(0.25) .RightMargin = Application.InchesToPoints(0.25) .TopMargin = Application.InchesToPoints(0.75) .BottomMargin = Application.InchesToPoints(0.75) .HeaderMargin = Application.InchesToPoints(0.3) .FooterMargin = Application.InchesToPoints(0.3) .Orientation = xlLandscape .PaperSize = xlPaperA3 .Zoom = 100 End With Application.PrintCommunication = True
-
Great
Since you are using ActiveSheet within your code ...you can have the same macro for all your printing jobs ...
-
But it only works on the one sheet I activate and set it on........can I do all the pages with one sub or do I have to activate each sheet individually and run the code for each, cheers.
-
-
Would you mind posting your macro ... in its entirety ...
-
By the way, forgot to ask you :
Do you need the User to select which sheet is to be printed ...
or
Do you need ALL sheets in one single go ...?
-
Sorry, I best not.....it has work stuff on it.
It has 10 sheets, if that helps.
-
Well ... not asking for your file ... BUT for the Print macro only ...
And did you see my message # 7 ...
-
Sorry, missed that one. The users will only print which sheets they need.
I posted the macro above.....but it only does one sheet at a time. Will With Workbook work somehow? I tried without luck.
-
-
Sorry, missed that one. The users will only print which sheets they need.
I posted the macro above.....but it only does one sheet at a time. Will With Workbook work somehow? I tried without luck.
The macro you posted above is ONLY a partial macro ...
An ENTIRE macro starts with its name Sub ... and ends with End Sub
-
Ok, see attached.
Code
Display MorePrivate Sub PrintSetup() Sheets("Last Mth Processed").Activate With ActiveSheet.PageSetup .LeftMargin = Application.InchesToPoints(0.25) .RightMargin = Application.InchesToPoints(0.25) .TopMargin = Application.InchesToPoints(0.75) .BottomMargin = Application.InchesToPoints(0.75) .HeaderMargin = Application.InchesToPoints(0.3) .FooterMargin = Application.InchesToPoints(0.3) .Orientation = xlLandscape .PaperSize = xlPaperA4 .Zoom = 100 End With Application.PrintCommunication = True End Sub
-
Thanks ...!!!
The very first instruction : Sheets("Last Mth Processed").Activate
is an instruction which ... by definition ... sends the user to this specific sheet and therefore restricts your Print macro ...
Have you tested your macro without this line ...?
-
You're a genius......that worked, it does all the sheets.
Thanks heaps for your perseverance.......much appreciated
-
Glad you could fix your problem ...
Thanks for Both your Thanks AND for the Like ...
-
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!