Custom Footer

G

Gator

What do I use to add the directory as a custom footer in the View/Header
Footer...I've used &[Path] and that doesn't work. I see a button to add the
file name...that's easy...but I can't get the directory on there.
 
S

ShaneDevenshire

Hi,

When you say &[Path] doesn't work, do you mean it doesn't put in the path or
do you mean it puts in more than you need?

1. If #1 then you probably need to save the file first
2. If #2 then you need to write VBA code and add it to the Before Print
event of the thisWorkbook object.
 
D

David Biddulph

In what particular way does &[Path] not work? What do you see there when
you do a print preview, as it works for me?
Which version of Excel are you using? On mine (Excel 2003) the button to
add path and file is immediately to the left of the button to add just the
file reference.
 
S

ShaneDevenshire

Hi again,

The code if you want that is

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftFooter = ActiveWorkbook.Path
End Sub
 
G

Gator

I should be more specific...I am using Excel 2000. I see where code can be
used. Is there some code I can use that will work automatically in any
workbook? Or would it be easier to use macro, and how would you implement
that macro
--
Gator


ShaneDevenshire said:
Hi,

When you say &[Path] doesn't work, do you mean it doesn't put in the path or
do you mean it puts in more than you need?

1. If #1 then you probably need to save the file first
2. If #2 then you need to write VBA code and add it to the Before Print
event of the thisWorkbook object.


--
Thanks,
Shane Devenshire


Gator said:
What do I use to add the directory as a custom footer in the View/Header
Footer...I've used &[Path] and that doesn't work. I see a button to add the
file name...that's easy...but I can't get the directory on there.
 
J

Jim Rech

[Path] was added in Excel 2002.

--
Jim
|I should be more specific...I am using Excel 2000. I see where code can be
| used. Is there some code I can use that will work automatically in any
| workbook? Or would it be easier to use macro, and how would you implement
| that macro
| --
| Gator
|
|
| "ShaneDevenshire" wrote:
|
| > Hi,
| >
| > When you say &[Path] doesn't work, do you mean it doesn't put in the
path or
| > do you mean it puts in more than you need?
| >
| > 1. If #1 then you probably need to save the file first
| > 2. If #2 then you need to write VBA code and add it to the Before Print
| > event of the thisWorkbook object.
| >
| >
| > --
| > Thanks,
| > Shane Devenshire
| >
| >
| > "Gator" wrote:
| >
| > > What do I use to add the directory as a custom footer in the
View/Header
| > > Footer...I've used &[Path] and that doesn't work. I see a button to
add the
| > > file name...that's easy...but I can't get the directory on there.
| > > --
| > > Gator
 
G

Gator

Is there a way to set this code where is will automatically work in Excel
anytime or do I have add it to each workbook I want to use it in. Also, do I
need to assign the code to a macro?
--
Gator


ShaneDevenshire said:
Hi again,

The code if you want that is

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftFooter = ActiveWorkbook.Path
End Sub

--
Thanks,
Shane Devenshire


Gator said:
What do I use to add the directory as a custom footer in the View/Header
Footer...I've used &[Path] and that doesn't work. I see a button to add the
file name...that's easy...but I can't get the directory on there.
 
S

ShaneDevenshire

The thisWorkbook object is unique for each workbook. You could add the code
to a default workbook and then all future workbooks would have it, but that
would not go back to previously created workbooks.

I suppose you can write a XLA that traps the print command in Excel and
applies the Path command to the current workbook, but I haven't tried it.
--
Cheers,
Shane Devenshire


Gator said:
Is there a way to set this code where is will automatically work in Excel
anytime or do I have add it to each workbook I want to use it in. Also, do I
need to assign the code to a macro?
--
Gator


ShaneDevenshire said:
Hi again,

The code if you want that is

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftFooter = ActiveWorkbook.Path
End Sub

--
Thanks,
Shane Devenshire


Gator said:
What do I use to add the directory as a custom footer in the View/Header
Footer...I've used &[Path] and that doesn't work. I see a button to add the
file name...that's easy...but I can't get the directory on there.
 
G

Gord Dibben

Right-click on the Excel Icon left of "File" on the menubar.

Copy/paste Shane's code into that module. Change nothing.......it is event
code, not a macro.

File>Save As Type: scroll down to Excel Template(*.XLT) and select. Name your
workbook "BOOK"(no quotes). Excel will add the .XLT to save as BOOK.XLT.

Store this workbook in the XLSTART folder usually located at........

C:\Documents and Settings\username\Application Data\Microsoft\Excel\XLSTART

This will be the default workbook for File>New or the Toolbar button File>New or
CTRL + n

WARNING................Do not use File>New...Blank Workbook or you will get the
Excel default workbook.

More can be found on this in Help under "templates"(no quotes).

NOTE: Existing workbooks are not affected by these settings.

To change those you could make Shane's code into a macro and store in your
Personal.xls.

Sub PathInFooter()
ActiveSheet.PageSetup.RightFooter = ActiveWorkbook.FullName & " " & _
ActiveSheet.Name & " " & Application.UserName & " " & Date
End Sub

Delete the bits you don't want.


Gord Dibben Excel MVP
 
D

Dave Peterson

You may want to try John Walkenbach's AddPath addin:
http://j-walk.com/ss/excel/files/addpath.htm

Including the version of excel that you're using is always a good idea <vbg>.
I should be more specific...I am using Excel 2000. I see where code can be
used. Is there some code I can use that will work automatically in any
workbook? Or would it be easier to use macro, and how would you implement
that macro
--
Gator

ShaneDevenshire said:
Hi,

When you say &[Path] doesn't work, do you mean it doesn't put in the path or
do you mean it puts in more than you need?

1. If #1 then you probably need to save the file first
2. If #2 then you need to write VBA code and add it to the Before Print
event of the thisWorkbook object.


--
Thanks,
Shane Devenshire


Gator said:
What do I use to add the directory as a custom footer in the View/Header
Footer...I've used &[Path] and that doesn't work. I see a button to add the
file name...that's easy...but I can't get the directory on there.
 
S

ShaneDevenshire

Hi Gator,

I have a way for you to add this code to all your workbooks, new and old.
Question is do you really want that? If I write the code you need it will be
in every file you open, new or old.

Let me know.
 

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

Top