file path in report footer


Posted by SteveM on April 27, 2001 7:06 AM

Back in the good ole' Lotus days I was able to create a cell in my worksheets with a formula for the complete file path. I could name the cell "path" that contained the formula and by using let's say \path in the footer section the file path appeared on each page of my printouts. I haven't been able to unlock the secret of how to put the file path in the footer except by means of manually keying in the information. There has got to be a better way, doesn't there?



Posted by Ivan Moala on April 27, 2001 7:48 AM

Hi Steve
One way to do this is via code;
If unsure on how to impliment this then post.

Sub Create_Footer_FilePath()
Dim sh As Worksheet
Dim PathName As String

'PathName is the path and filename
PathName = ActiveWorkbook.Path

For Each sh In ActiveWorkbook.Sheets
With sh
'comment out the appostraphe to select your page setup
'currently set on center
'.PageSetup.RightFooter = PathName
.PageSetup.CenterFooter = PathName
'.PageSetup.LeftFooter = PathName
'.PageSetup.RightHeader = PathName
'.PageSetup.CenterHeader = PathName
'.PageSetup.LeftHeader = fullpath
End With
Next sh
End Sub

Note: Once you run this code all the active workbooks footers will have the file path in it..


Ivan