File Name Footer

R

Rebecca

I am using Excel 2000 in Windows NT. I have found the way
to enter the file name as a footer. I would like to see
the entire path there and not jus teh file name. I have
seen it done but just can't figure out how to do it. Any
help?

Thanks in advance.

Rebecca
 
R

Ron de Bruin

You can place this in the thisworkbook module

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In ActiveWindow.SelectedSheets
wkSht.PageSetup.LeftFooter = "&8" & ActiveWorkbook.FullName
Next wkSht
End Sub

If you print it will place the path in the footer
 
J

jr

use:
VIEW | HEADER/FOOTER
one of the options will be to include the path as well as
the filename.
 
D

David McRitchie

That option is only available in Excel 2002 and the poster has Excel 2000.

Further consideration on compatibility: If more than one person updates the
file and they don't all have Excel 2002 or higher you can't really use it.
 
D

David McRitchie

In addition to Ron's code, you might want to include the sheetname
as well in the leftfooter. You can test with Print Preview.

The &8 which Ron used is to make to font smaller and changing to lowercase helps
for consistency and keeping the width down. The &A is the sheetname
F1 (HELP) --> answer wizard -> Formatting Codes for Headers and Footers

The reduced fontsize also helps to distinguish between footer
and data especially if gridlines or borders are not visible.
Since you have more control of the sheetname it is left exactly
as you have it and not made lowercase. Ron's modified codec

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In ActiveWindow.SelectedSheets
wkSht.PageSetup.LeftFooter = _
"&8" & LCase(ActiveWorkbook.FullName) & " &A "
Next wkSht
End Sub

FWIW, Excel 2002 does provide for full pathname in your headers / footers
without use of code. But of course that means everyone who uses or
updates would also have to have Excel XP as well. So even you moved up
doesn't necessarily make it easier for you.

More information on headers and footers
http://www.mvps.org/dmcritchie/excel/pathname.htm
 

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