Inserting filepath and filename

  • Thread starter Thread starter Paul Vovk
  • Start date Start date
P

Paul Vovk

Under File->Page Setup then tab Header/Footer then Custom
Footer. There you will see various icons to place the path
and filename and also worksheet name, page #, etc.
 
The below works, but there is a slight difference in
EXCEL. In WORD you can do as described below. But, in
EXCEL, using this method, only the FILENAME is displayed
and not the entire path (at least in the OFFICE 97 Suite).

So,does anyone know a way to make Excel disply the
complete PATHNAME with the FILENAME just like WORD
currently does?
 
A Better A proach is to USed the macro Like this
Sub Auto_Open()
ActiveSheet.PageSetup.RightFooter = ThisWorkbook.Path &
ActiveWorkbook.FullName
End Sub
 
Why would this be better than a Workbook_BeforePrint event macro? If
you use Auto_Open and the user then does a SaveAs to a different
location/filename, the footer won't be updated.

Also, if you use Auto_Open and the workbook is opened via VBA, the
macro won't run without explicitly calling RunAutoMacros.

Finally - FullName includes the path, so using ThisWorkbook.Path and
ActiveWorkbook.FullName will duplicate the path (which you could
have seen if you tried it). And while in this case it's probably not
an issue, mixing ThisWorkbook and ActiveWorkbook can give strange
results if more than one workbook is open/activated while the macro
runs.
 
Back
Top