MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Inserting a PATH into the footer...

Posted by Joanna on February 28, 2001 7:33 PM

I know how to get a filename to appear in the footer, but is there a way to get the entire pathname into the footer?

Thanks for your help!

Posted by David Hawley on February 28, 2001 7:49 PM

Hi Joanna

Not without VBA!

Right click on the sheet picture with the X on it, top left next to "File" and paste in this code over the top of what you see. Push Alt+Q to return to Excel and Save.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Reply As Integer, Filepath As String
Reply = MsgBox("Hello Joanna, would you like the file path ?" _
, vbYesNo, "OzGrid.Com")
If Reply = vbYes Then
Filepath = Me.FullName
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = Filepath
.CenterFooter = ""
.RightFooter = ""
End With
End If
End Sub

Any good ?


OzGrid Business Applications

Posted by Erin on March 02, 2001 6:28 AM

You can also use the CELL function, however, you cannot insert this formula in the footer. Try using the following formula at the end of the sheet. type... =CELL("filename")

Hope this helps...