Inserting filepath and filename

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.
 
J

Jim H.

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?
 
J

Jose Rojas

A Better A proach is to USed the macro Like this
Sub Auto_Open()
ActiveSheet.PageSetup.RightFooter = ThisWorkbook.Path &
ActiveWorkbook.FullName
End Sub
 
J

J.E. McGimpsey

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.
 

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

Top