filename and path

  • Thread starter Thread starter Johay
  • Start date Start date
J

Johay

In Word you can put the filename and path with an
autoinsert. Is there anyway to do this in excel. We would
like the filename and path as a footer. Is there anyway
without typing in yourself manually?
 
Hi
depens on your Excel version. I thinks since Excel 2002 this is a filed
in the customer header/footer dialog. For versions prior to this
put the following code in your workbook module (not in a standard
module):

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In Me.Worksheets
With wkSht.PageSetup
.CenterFooter = Me.FullName
End With
Next wkSht
End Sub
 
Johay

Where would you like the file and path to appear? In the header or footer?

XL2002 and 2003 make provision for this at the Custom Footer or Header Dialog
Box.

Earlier versions require a macro.

Sub PathInFooter()
ActiveSheet.PageSetup.RightFooter = ActiveWorkbook.FullName
End Sub

OR download John Walkenbach's Add-in from

http://www.j-walk.com/ss/excel/files/addpath.htm

Gord Dibben Excel MVP
 
What is a workbook module?
-----Original Message-----
Hi
depens on your Excel version. I thinks since Excel 2002 this is a filed
in the customer header/footer dialog. For versions prior to this
put the following code in your workbook module (not in a standard
module):

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In Me.Worksheets
With wkSht.PageSetup
.CenterFooter = Me.FullName
End With
Next wkSht
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany



.
 
Hi
- open the VBA editor (ALT+F11)
- check if the project explorer is open (if not hit CTRL+R)
- locate for your project the entry 'ThisWorkbook' and double-click on
this entry

This is the workbook module
 

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