#1
|
|||
|
|||
Formatting Macro based on Zoom (PageScale)
I am new and inexperienced with programing, so I apologize for using the wrong terminology in advance.
I would like to create a Formatting macro that would set the worksheet to (1) Page Wide by (unknown) Tall on Letter size paper Landscape. Once the formatting is complete, I would like it then to add (+1) page wide if the Zoom (Page Scaling) is under 40%. If Page Scaling is still under 40% after that add (+1) more page to Wide. Is this possible with a macro? And if so, what are the basic steps to set up this formula? I have the below at the moment which sets a worksheet (1) page Wide by (False) Tall, Letter, Landscape. Code:
Sub Formatting() Application.PrintCommunication = False With ActiveSheet.PageSetup .PrintTitleRows = "" .PrintTitleColumns = "" End With Application.PrintCommunication = True ActiveSheet.PageSetup.PrintArea = "" Application.PrintCommunication = False With ActiveSheet.PageSetup .Orientation = xlLandscape .PaperSize = xlPaperLetter .Order = xlOverThenDown .Zoom = False .FitToPagesWide = 1 .FitToPagesTall = False End With Application.PrintCommunication = True End Sub Thank you. |
#2
|
||||
|
||||
It's not entirely clear what you mean by the (+1) references. However, assuming you're wanting to increase the zoom in 1% increments, try:
Code:
Sub Formatting() Application.ScreenUpdating = False With ActiveSheet.PageSetup .Orientation = xlLandscape .PaperSize = xlPaperLetter .Zoom = False .FitToPagesWide = 1 .FitToPagesTall = False If .Zoom < 40 Then .Zoom = .Zoom + 1 If .Zoom < 40 Then .Zoom = .Zoom + 1 End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
Heck, if he wanted to increase Zoom until it was up to 40, all he'd have to do is say
Code:
If .Zoom < 40 Then .Zoom = 40 In other words, he wants a loop like this: Code:
Do While .Zoom < 40 .FitToPagesWide = .FitToPagesWide + 1 Loop |
#4
|
||||
|
||||
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
||||
|
||||
The key sentence is probably this:
Quote:
|
#6
|
|||
|
|||
Yes. This is what I was after.
Quote:
|
#7
|
||||
|
||||
Seems to me, then, is all you have to do is figure out how to add a page-wide and page-tall in your program, and then start the loop. Do you know how? You should be able to do it by recording a macro, and then modifying it from there.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word VBA Macro to Find and Replace based on the Alt Text of an Image | bennymc | Word VBA | 1 | 01-27-2014 04:23 PM |
MACRO - Insert row based on Form Field Criteria | Elan05 | Word VBA | 5 | 04-16-2013 06:39 AM |
Conditional formatting question based on cell date | Cosmo | Excel | 2 | 04-08-2013 12:12 PM |
Macro based on cell value | ubns | Excel Programming | 1 | 05-07-2012 04:03 AM |
Conditional Formatting Expiration Dates Based on Text in Adjacent Cell | Frogggg | Excel | 1 | 10-25-2011 08:44 PM |