Macro help: File path in Excel 2000

G

Guest

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
 
D

Daniel CHEN

Add line break at the end of left and right footers like:

..LeftFooter = "&9Created By: John XXXXX" & Chr(10) & "Printed On: &D" &
vbCrLf
..CenterFooter =
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
..RightFooter = "&9Page: &P" & vbCrLf

--
Best regards,
---
Yongjun CHEN
=================================
XLDataSoft - Data Analysis Expert, Excel/VBA Specialist
- - - - www.XLDataSoft.com - - - -
Free Excel-Based Data Processing Tool is Available for Download
Free Excel / VBA Training Materials is Available for Download
=================================
 
B

Bernie Deitrick

..LeftFooter = "&9Created By: John XXXXX" & Chr(10) & "Printed On: &D" & Chr(10) & " "
..CenterFooter = " " & Chr(10) & " " & Chr(10) & ActiveWorkbook.FullName
..RightFooter = "&9Page: &P" & Chr(10) & " "
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top