M
macronewfie
I am new to macros and would like to create a macro that formats the header
and footer to include the name of the worksheet, my name, the date printed,
number of pages and the path of the filename. I have come up with the
following macro but when I run it, long file locations overwrite other info
on the footer. How can I format my macro to write the file address on the
'bottom' line of my footer, well below my other footer information.
Sub AppliesFormattingToSheet()
'
' AppliesFormattingToSheet Macro
' Macro recorded 5/25/2006 by xxxx'
' Keyboard Shortcut: Ctrl+z
'
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "&""MS Sans Serif,Bold""&16&A"
.RightHeader = ""
.LeftFooter = "&9Created By: John XXXXX" & Chr(10) & "Printed On: &D"
.CenterFooter = ActiveWorkbook.FullName
.RightFooter = "&9Page: &P"
.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
Regards,
macronewfie
and footer to include the name of the worksheet, my name, the date printed,
number of pages and the path of the filename. I have come up with the
following macro but when I run it, long file locations overwrite other info
on the footer. How can I format my macro to write the file address on the
'bottom' line of my footer, well below my other footer information.
Sub AppliesFormattingToSheet()
'
' AppliesFormattingToSheet Macro
' Macro recorded 5/25/2006 by xxxx'
' Keyboard Shortcut: Ctrl+z
'
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "&""MS Sans Serif,Bold""&16&A"
.RightHeader = ""
.LeftFooter = "&9Created By: John XXXXX" & Chr(10) & "Printed On: &D"
.CenterFooter = ActiveWorkbook.FullName
.RightFooter = "&9Page: &P"
.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
Regards,
macronewfie