merrymonk has asked for the wisdom of the Perl Monks concerning the following question:
I tried this but it did not work in an Excel 2007 spreadsheet. Therefore I tried the recommended practice of recording an Excel macro when I used the Fit to Page option – selecting one page for fitting. This gave the following$sheet -> PageSetup -> {FitToPagesWide} = 1;
This included the equivalent of the one liner I found and a lot of other settings as well.With ActiveSheet.PageSetup .PrintTitleRows = "" .PrintTitleColumns = "" End With ActiveSheet.PageSetup.PrintArea = "" With ActiveSheet.PageSetup .LeftHeader = "" .CenterHeader = "" .RightHeader = "" .LeftFooter = "" .CenterFooter = "" .RightFooter = "" .LeftMargin = Application.InchesToPoints(0.138888888888889) .RightMargin = Application.InchesToPoints(0.277777777777778) .TopMargin = Application.InchesToPoints(6.94444444444444E-02) .BottomMargin = Application.InchesToPoints(0.347222222222222) .HeaderMargin = Application.InchesToPoints(0.3) .FooterMargin = Application.InchesToPoints(0.3) .PrintHeadings = False .PrintGridlines = False .PrintComments = xlPrintNoComments .PrintQuality = -3 .CenterHorizontally = False .CenterVertically = False .Orientation = xlLandscape .Draft = False .PaperSize = xlPaperA4 .FirstPageNumber = xlAutomatic .Order = xlDownThenOver .BlackAndWhite = False .Zoom = False .FitToPagesWide = 1 .FitToPagesTall = 0 .PrintErrors = xlPrintErrorsDisplayed .OddAndEvenPagesHeaderFooter = False .DifferentFirstPageHeaderFooter = False .ScaleWithDocHeaderFooter = True .AlignMarginsHeaderFooter = True .EvenPage.LeftHeader.Text = "" .EvenPage.CenterHeader.Text = "" .EvenPage.RightHeader.Text = "" .EvenPage.LeftFooter.Text = "" .EvenPage.CenterFooter.Text = "" .EvenPage.RightFooter.Text = "" .FirstPage.LeftHeader.Text = "" .FirstPage.CenterHeader.Text = "" .FirstPage.RightHeader.Text = "" .FirstPage.LeftFooter.Text = "" .FirstPage.CenterFooter.Text = "" .FirstPage.RightFooter.Text = "" End With
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Excel - Setting Fit to Page Query
by Anonymous Monk on Jun 21, 2010 at 10:59 UTC | |
by merrymonk (Hermit) on Jun 21, 2010 at 11:16 UTC | |
|
Re: Excel - Setting Fit to Page Query
by davies (Monsignor) on Jun 21, 2010 at 11:12 UTC |