Path in page footer

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I include the full path of where the document resides on my
workstation, in the footer of my worksheets?
 
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wsSht As Worksheet
For Each wsSht In ActiveWindow.SelectedSheets
wsSht.PageSetup.LeftFooter = "&""Arial,Bold""&8" & Me.FullName
Next wsSht
End Sub


'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code



--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Thanks Bob,

I've found similar code from Microsoft, but I'm looking to do it from a
global perspective, if it is at all doable. Sorry for leaving out that
little detail. Can it be done?

There is a toolbar in word that allows for this, but I can't seem to locate
anything outside of code that will allow me to do it in Excel.
 
Josh,

You could try this. Add this code to Personal.xls, and it will then
automatically set the footer for any sheet in any workbook.

Private WithEvents app As Application

Private Sub app_WorkbookBeforePrint(ByVal Wb As Workbook, Cancel As Boolean)
With Wb.ActiveSheet
.PageSetup.LeftFooter = "&""Arial,Bold""&8" & Wb.FullName
End With
End Sub

Private Sub Workbook_Open()
Set app = Application
End Sub


'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Thanks again Bob,

I've added the code to a workbook I've entitled as personal.xls. Is there a
specific location where this file should be saved for it to affect all other
workbooks? Or should it be saved as a template, from which to create new
workbooks?

I'm not sure that I did things correctly, because the code did not work on
the file itself. When I type in the following code, I get the desired
results... one page at a time:

Sub UpdateFooter()
ActiveSheet.PageSetup.LeftFooter = ActiveWorkbook.FullName
End Sub
 
Joshua,

The hint is at the foot of the message. You need to store it in ThisWorbook,
see the directions. It also needs to be initialised, so close down Excel,
and start anew. The Workbook_Open should kick it off.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
John Walkenbach has an addin you may like.
http://j-walk.com/ss/excel/files/addpath.htm

It builds the macro code for you if you run the macro. (You may not always want
to do this???).

You can save John's addin anywhere, then turn it on via Tools|Addins (and point
to the location where you saved the addin).

Alternatively, if you're running xl2002+ (which supports the full path in
headers/footers), you could use a couple of template files.

Create a new workbook named book.xlt and set up the page layout the way you
want.

Save this book.xlt in your XLStart folder.

You can create another single sheet workbook that has the same page layout, but
save it as sheet.xlt.

Any new workbook will inherit the settings from book.xlt. Any new worksheet
added to an existing workbook will inherit the settings from sheet.xlt.

But this won't help any existing worksheets in existing workbooks.
 

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