Path and filename in every Excel workbook

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

Guest

Hi

I want to insert the full path and filename of the workbook into the footer, but as I've looked around and can only find solutions where I have to insert a macro into every workbook I use. That is to much work. To put it in another way: I want the path and filname to be inserted without me having to do anything at all, only print or save the document

Hope anyone can help me

Thank you in advance

Andreas
 
Hi Andreas
AFAIK the macro solution is the only way to go. Until MS decides to
include this functionality in Excel directly

Frank
 
Andreas,

If you want this functionality for future workbooks, follow this

- open a new workbook
- add this code to the ThisWorkbook code module
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet
.PageSetup.LeftFooter = ActiveWorkbook.FullName
End With
End Sub

- saved this workbook as a template called Book.xlt in the XLStart
directory.

This will then apply to all new workbooks

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Andreas Indahl said:
Hi,

I want to insert the full path and filename of the workbook into the
footer, but as I've looked around and can only find solutions where I have
to insert a macro into every workbook I use. That is to much work. To put it
in another way: I want the path and filname to be inserted without me having
to do anything at all, only print or save the document.
 
Maybe change Bob's example to this
This also work if the user have more sheets select

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In ActiveWindow.SelectedSheets
wkSht.PageSetup.LeftFooter = ActiveWorkbook.FullName
Next wkSht
End Sub
 
Back
Top