MrExcel Publishing
Your One Stop for Excel Tips & Solutions

setting header/footer defaults in print


Posted by Paul D on June 15, 2001 10:09 AM

How can I set up the default on my print preview/printing to always show the filename as the header and the date as the footer, regardless of what file is opened? Now, I have to set the headers and footers before each printout.


Posted by thomas venn on June 15, 2001 12:03 PM


try this:

Sub Macro1()

With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = "&F"
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = "&D"
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
End With
End Sub

you can record the macro yourself by clicking on the record button, then go to File->Page Setup-> do your header and footer thing, click ok, then stop recording.

cheers,

-thomas

Posted by Mark W. on June 15, 2001 12:28 PM

Save a Book.xlt with your desired header/footer to
your XLStart folder (within the Office folder). Now
each new workbook you subsequently create will use
this default.