If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Pagesetup.Orientation need VBA routine to "Best Guess" Orientation
2003/2007
What parameters/settings with PageSetup could provide assist with calculating PageOrientation to be placed in a macro to "best guess" it? i.e. .Orientation = IIf (height 2 * width AND Columns.count 9),"Portrait","Landscape") Is there a way to use inches in the height/width calculation? Is there a better approach? TIA EagleOne |
#2
|
|||
|
|||
Pagesetup.Orientation need VBA routine to "Best Guess" Orientation
Your algorithm is a good start. Use the range.width or .height and multiply
the results (in points) by 72 to get inches. I can't think of a better way. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ wrote in message ... 2003/2007 What parameters/settings with PageSetup could provide assist with calculating PageOrientation to be placed in a macro to "best guess" it? i.e. .Orientation = IIf (height 2 * width AND Columns.count 9),"Portrait","Landscape") Is there a way to use inches in the height/width calculation? Is there a better approach? TIA EagleOne |
#3
|
|||
|
|||
Pagesetup.Orientation need VBA routine to "Best Guess" Orientation
Thanks Jon
"Jon Peltier" wrote: Your algorithm is a good start. Use the range.width or .height and multiply the results (in points) by 72 to get inches. I can't think of a better way. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ wrote in message .. . 2003/2007 What parameters/settings with PageSetup could provide assist with calculating PageOrientation to be placed in a macro to "best guess" it? i.e. .Orientation = IIf (height 2 * width AND Columns.count 9),"Portrait","Landscape") Is there a way to use inches in the height/width calculation? Is there a better approach? TIA EagleOne |
#4
|
|||
|
|||
Word 2007 Version of this problem.
I guess you were talking about Excel?
I am having this problem with Word 2007 An old 2003 macro used to work which used For Each oSection In ActiveDocument.Sections If oSection.PageSetup.Orientation = wdOrientPortrait Then It was not responding correctly I didn't mess much with it and switched to For Each oSection In ActiveDocument.Sections oSection.Range.Select If Selection.PageSetup.Orientation = wdOrientPortrait Then Never mind the oSection.Range.Select, when single stepping and manually placing the selection it didn't work right. And issuing ?Selection.PageSetup.Orientation in the immediate window. It seemed to respond only to my clicking the landscape/portrait buttons on the ribbon. (not to the actual orientation of the page the cursor was on (selection). And since it toggled when the buttons were pressed instead of what the selected page actually was then it would appear to be working 50% of the time depending on what the page was that you first changed the orientation. Then I also saw it respond once, and only once to moving the cursor with the mouse. I clicked on a portrait page and re-evaluated ?Selection.PageSetup.Orientation. and it toggled from wdOrientLandscape (0) to wdOrientPortrait (1) But i could not reproduce this. It returned to responding only to the buttons. There is a chance I mixed a orientation button press and contaminated that one occurance. I may have forgotten to evaluate before clicking to ensure that it was actually the click that changed the value. And I could not reproduce it . . . I think it is totally broken. How in the world would it become disconnected from the page/selection object and connected to the interface. Unless there is a improperly controlled property of the page that somehow gets out of phase with the actual orientation. It is like some kind of prank. Really annoying. I guess I may have to compare height and width as the Excel solution did. EagleOn wrote: Pagesetup.Orientation need VBA routine to "Best Guess" Orientation 04-May-07 Thanks Jon Previous Posts In This Thread: On Friday, May 04, 2007 7:40 AM EagleOn wrote: Pagesetup.Orientation need VBA routine to "Best Guess" Orientation 2003/2007 What parameters/settings with PageSetup could provide assist with calculating PageOrientation to be placed in a macro to "best guess" it? i.e. .Orientation = IIf (height 2 * width AND Columns.count 9),"Portrait","Landscape") Is there a way to use inches in the height/width calculation? Is there a better approach? TIA EagleOne On Friday, May 04, 2007 12:45 PM Jon Peltier wrote: Your algorithm is a good start. Use the range.width or . Your algorithm is a good start. Use the range.width or .height and multiply the results (in points) by 72 to get inches. I can't think of a better way. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ wrote in message ... On Friday, May 04, 2007 1:00 PM EagleOn wrote: Pagesetup.Orientation need VBA routine to "Best Guess" Orientation Thanks Jon EggHeadCafe - Software Developer Portal of Choice Book Review: Silverlight 3 Programmer's Reference [Wrox] http://www.eggheadcafe.com/tutorials...lverlight.aspx |
Thread Tools | |
Display Modes | |
|
|