PDA

View Full Version : File Name/Path footers in Excel



andrew_ivey
10-06-2005, 11:50 AM
Simple question hopefully, in Word we put in the footer the filename and path so everyone can find the file, but the customer footer option in Excel only gives you the file name, and you have to manually type the path to the file.
Anyway to create this automatically?
Ta,
Andrew.

Marlboro
10-06-2005, 11:57 AM
Try this in the footer or header:

&[Path]&[File]

rad_s4
10-06-2005, 02:15 PM
Up to and including Excel 2000 - [Path] is not recognised in a header or footer - don't know about compatibility with later versions of Excel.

You can automatically add the full path and name of the file via macro code.
The following macro code captures the BeforePrint event and inserts the left footer as full file path and name just prior to the job being printed.

With the workbook open, press <Alt> and <F11> to open the VB editor,
right click on the ThisWorkbook icon and select View Code and paste the following code. Press <Alt><F11> again to return to the workbook.

If any worksheet in the workbook is printed, the footer will be inserted.
File Save the workbook to retain this feature.

HTH

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftFooter = ActiveWorkbook.FullName
End Sub