filename and path

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?
 
F

Frank Kabel

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
 
G

Gord Dibben

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
 
J

jodhay

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



.
 
F

Frank Kabel

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
 
Top