Optimize Beginner's Code

  • Thread starter Thread starter slappy54
  • Start date Start date
S

slappy54

Is there a way I can find the default values? I'm trying to optimize the
code and figured a could get rid of some of this.

Thanks,
Mike


With ActiveSheet.PageSetup
.CenterFooter = "&P"
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.25)
.FooterMargin = Application.InchesToPoints(0)
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
End With
 
You can write a macro to display the current values on a fresh sheet. That
would show you what YOUR defaults are.

However, if someone customizes their default sheet or default workbook, what
you "assume" is a default isn't necessarily going to be correct. So if you
really want to ensure that things are exactly as you want them, go ahead and
set ALL the values.

If you are working strictly on your own machine in a controlled environment,
the code will run a bit faster if you only set those that need to be
changed.
--
HTH -

-Frank Isaacs
Dolphin Technology Corp.
http://vbapro.com
 
Back
Top