This site will look better if you upgrade to a browser that supports web standards.
In XL98/2001/v.X (and in WinXL97/00), there is no provision for including the Drive path and filename in a header or footer. This is a common requirement in business applications, and was remedied in WinXL2002.
Here's a way to manually place the path and filename in the left-hand footer. Put the macro in your Personal Macro Workbook (Personal.xls for WinXL). Call the macro from the dialog, or attach the macro to a toolbar button or keyboard shortcut.
Public Sub PathAndFileNameInFooter() Dim wsSht As Worksheet For Each wsSht In ActiveWindow.SelectedSheets wsSht.PageSetup.LeftFooter = ActiveWorkbook.FullName Next wsSht End Sub
Note that the macro cycles through every selected sheet, since the user may select more than one.
You can replace .LeftFooter with .LeftHeader, .CenterHeader, .RightHeader, .CenterFooter, or .RightFooter, depending on the desired placement. You can also concatenate formatting instructions using the header/footer formatting codes - see "Formatting codes for headers and footers" in XL/VBA help.
You can automate this task by putting this macro in the ThisWorkbook code module of your workbook The header or footer will be updated whenever the user chooses to or :
Private Sub Workbook_BeforePrint(Cancel As Boolean) Dim wsSht As Worksheet For Each wsSht In ActiveWindow.SelectedSheets wsSht.PageSetup.LeftFooter = Me.FullName Next wsSht End Sub
You can use template or class module to make new or all workbooks print with the path and filename in the footer.
This page last updated
© Copyright 2001 - 2004 McGimpsey and Associates. Except where noted, all code on this site may be distributed under the Gnu GPL. Acknowledgement is appreciated.
Unfamiliar with macros? See David McRitchie's Getting Started With Macros and User Defined Functions
How to make all or new workbooks print the path and filename