View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Matthew Dyer Matthew Dyer is offline
external usenet poster
 
Posts: 178
Default page setup preferances

So I'd like to be able to assign page setup preferances when a macro
of mine creates new sheets. This is the code i've been able to use to
do what I need to do, but it takes much longer to perform this code
than I thought it would. Does anyone have any suggestions to perform
the same actions with code that runs more quickly? All I need to do is
set all margins to .5, set the pages wide to 1 and the pages tall to
3. I've tried to cut out some of the code that seems unecessary, but
then the pages wide/tall adjustments aren't made, only the margins.
Code:
 With WSNew.PageSetup
                   .LeftMargin = Application.InchesToPoints(0.5)
                   .RightMargin = Application.InchesToPoints(0.5)
                   .TopMargin = Application.InchesToPoints(0.5)
                   .BottomMargin = Application.InchesToPoints(0.5)
                   .HeaderMargin = Application.InchesToPoints(0.5)
                   .FooterMargin = Application.InchesToPoints(0.5)
                   .PrintHeadings = False
                   .PrintGridlines = False
                   .PrintComments = xlPrintNoComments
                   .PrintQuality = 600
                   .CenterHorizontally = False
                   .CenterVertically = False
                   .PaperSize = xlPaperLetter
                   .FirstPageNumber = xlAutomatic
                   .Orientation = xlPortrait
                   .Draft = False
                   .Order = xlDownThenOver
                   .BlackAndWhite = False
                   .Zoom = False
                   .PrintErrors = xlPrintErrorsDisplayed
                   .FitToPagesWide = 1
                   .FitToPagesTall = 3
                End With