Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding the entire path to an Excel report

Status
Not open for further replies.

TallGuyinIT

IS-IT--Management
Oct 18, 2004
34
US
I have an excel template setup with all my preferences that I use whenever I start a new spreadsheet. I am using the &[file] command in the print footer to display the file name. I would like to print the file path & name in every footer. Is there a way to add a command to the template that would do this?

I have tried putting &[INFO(directory)] before &[file] and that does not seem to work.

Thank you for your help.
 
What version of Excel are you on?

Starting in 2003, there is a Path and File button.

But since you're asking, I assume you are on an earlier version.

If that is the case, you'll need to use a macro. Something like this:

Code:
Sub AddPathToFooter()
    For Each sht In ActiveWorkbook.Sheets
        sht.PageSetup.LeftFooter = ActiveWorkbook.FullName
    Next sht
End Sub
That code will add the full path to the left footer on each sheet in the active workbook. You could use CenterFooter or RightFooter instead, if you wish.

If you're unfamiliar with macros, then see faq707-5758, "So where exactly do I put this macro code then??".

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top