Dispalying File name and path in a footer

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

I know I can get filename with &[File]. Is there
something for folder path???

Yhank You Kindly
 
Hi
depending on your Excel version you need VBA for doing this. Put the
following code in your workbook 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
 
Hi Frank - can this be used for making a default 'new' when one opens excel for the first time? I'm using Version 2000 and I've created a macro from one of the other suggestions prior, but this means that in the new 'template' that I've created, I have to run the macro before I get the new file path and filename to appear. Is there a way to do this automatically? Or does the macro below autoupdate the path and will work with a 'template' ... like the normal.dot in word? Thanks in advance

----- Frank Kabel wrote: ----

H
depending on your Excel version you need VBA for doing this. Put th
following code in your workbook module
Private Sub Workbook_BeforePrint(Cancel As Boolean
Dim wkSht As Workshee
For Each wkSht In Me.Worksheet
With wkSht.PageSetu
.CenterFooter = Me.FullNam
End Wit
Next wkSh
End Su

-
Regard
Frank Kabe
Frankfurt, German


Gary wrote
I know I can get filename with &[File]. Is ther
something for folder path??
Yhank You Kindl
 
If you put the code in your default workbook template (book.xlt kept in your
xlstart folder), then every workbook that's based on this template will inherit
the macro.

But for me, that seems excessive--I wouldn't want all my new workbooks set up
this way.

But I could live with an "on-demand" addin that did the work for me. John
Walkenbach's addin is very nice:

http://j-walk.com/ss/excel/files/addpath.htm
Hi Frank - can this be used for making a default 'new' when one opens excel for the first time? I'm using Version 2000 and I've created a macro from one of the other suggestions prior, but this means that in the new 'template' that I've created, I have to run the macro before I get the new file path and filename to appear. Is there a way to do this automatically? Or does the macro below autoupdate the path and will work with a 'template' ... like the normal.dot in word? Thanks in advance!

----- Frank Kabel wrote: -----

Hi
depending on your Excel version you need VBA for doing this. Put the
following code in your workbook 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

I know I can get filename with &[File]. Is there
something for folder path???
Yhank You Kindly
 
Thanks Dave - I know this seems a bit excessive - some people here at work are thinking about this though. I think there should just be a template that they can use instead of having each new spreadsheet have this stuff in the footer - might get annoying as I'm noticing in my new normal.dot for Word. :

Thank you for the reply! :)
 

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