![]() |
How to set page orientation to "landscape"
Hey everybody,
I'm writing a script that evaulates a spreadsheet in excel and conditionally formats it based on content. In addition to conditionally formatting the spreadsheet, I also want the VBA to prep the spreadsheet for printing. When I run the following code I am told that I am using the XLPageOrientation property incorrectly...please advise: With ActiveSheet.PageSetup .CenterHeader = "&""Arial,Bold""&18Pooled Staff Level 31, 33, Interns" .CenterFooter = "&""Arial,Bold""&10&P of &N" .XlPageOrientation.xlLandscape .XlPaperSize = xlPaperLegal .TopMargin.InchesToPoints = 1 .BottomMargin.InchesToPoints = 1 .LeftMargin.InchesToPoints = 0.75 .RightMargin.InchesToPoints = 0.75 .HeaderMargin.InchesToPoints = 0.5 .FooterMargin.InchesToPoints = 0.5 .PrintTitleRows = ActiveSheet.Rows(2).Address .PrintTitleColumns = ActiveSheet.Columns("A:B").Address .XlOrder = xlDownThenOver .XlObjectSize = xlFitToPage End With |
How to set page orientation to "landscape"
try this...
..Orientation = xlLandscape -- HTH... Jim Thomlinson "Steve P" wrote: Hey everybody, I'm writing a script that evaulates a spreadsheet in excel and conditionally formats it based on content. In addition to conditionally formatting the spreadsheet, I also want the VBA to prep the spreadsheet for printing. When I run the following code I am told that I am using the XLPageOrientation property incorrectly...please advise: With ActiveSheet.PageSetup .CenterHeader = "&""Arial,Bold""&18Pooled Staff Level 31, 33, Interns" .CenterFooter = "&""Arial,Bold""&10&P of &N" .XlPageOrientation.xlLandscape .XlPaperSize = xlPaperLegal .TopMargin.InchesToPoints = 1 .BottomMargin.InchesToPoints = 1 .LeftMargin.InchesToPoints = 0.75 .RightMargin.InchesToPoints = 0.75 .HeaderMargin.InchesToPoints = 0.5 .FooterMargin.InchesToPoints = 0.5 .PrintTitleRows = ActiveSheet.Rows(2).Address .PrintTitleColumns = ActiveSheet.Columns("A:B").Address .XlOrder = xlDownThenOver .XlObjectSize = xlFitToPage End With |
All times are GMT +1. The time now is 04:21 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com