Excel file directory path appear on printout

  • Thread starter Thread starter Bill Zinkhofer
  • Start date Start date
B

Bill Zinkhofer

How does one get the Excel workbook to print its file
directory path?
 
Hi Bill!

Excel 2002 (XP)


This is built into Excel 2002.



Put the following in the footer:
&[Path]&[File]

Excel 97 and Excel 2000


You need a macro (or just type the full name in):



This subroutine which must be put in ThisWorkbook module puts the path
and workbook name in the footer.



Private Sub Workbook_BeforePrint(Cancel As Boolean)

ActiveSheet.PageSetup.LeftFooter = ActiveWorkbook.FullName

End Sub





For any workbook you can put the following code in the ThisWorkbook
module in the workbook that you want to print out:



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

You can substitute CenterFooter or RightFooter for LeftFooter.



John Walkenbach has a nice addin that you may like at:
http://j-walk.com/ss/excel/files/addpath.htm

There's also more code examples and options for headers and footers
at:



Dave McRitchie

http://www.mvps.org/dmcritchie/excel/pathname.htm
(Pathname in headings, footers, and cells)




--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
Holidays and Observances Saturday 19th July: Andorra (Canillo), France
(Edgar Degas Birthday), Laos (Independence Day), Malaysia (Birthday of
Yand di-Pertuan Besar of Mg Sembilan), Myanmar (Martyrs' Day),
Nicaragua (Revolution / Sandinista Day).
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 

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

Back
Top