Insert Filepath & Auto-Update It

  • Thread starter Thread starter Erin
  • Start date Start date
E

Erin

Is there a way to insert the full filename and path of an
Excel document, and then have it auto-update if you "save
as" somewhere else, and then open the later version?
Microsoft Word has an Insert Auto Text function which does
this, but is it available in Excel??

THANKS!
 
Where do you want it inserted?

If in a worksheet cell, then use

=LEFT(CELL("filename",A1), FIND("]", CELL("filename",A1)))

If in a header or footer, XL02 has the capability of putting that in
directly. For other versions, put this in the ThisWorkbook code
module (right-click on the workbook title bar, choose View Code,
paste the following in the window that opens, then click the XL
icon on the toolbar to return to XL):

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet

For Each wkSht In ActiveWindow.SelectedSheets
wkSht.PageSetup.LeftFooter = ActiveWorkbook.FullName
Next wkSht
End Sub

You can substitute CenterFooter or RightFooter for LeftFooter.
 
Back
Top