Adding the Path Address to the Header/Footer

To add the Path to a header or footer while printing when using Excel 97 & Excel 2000, add an Event (macro code lines) that will automatically cause information, including the Path, to appear on each sheet you print from the workbook.

To add the path to a header or footer:

1. Open the VBE (Visual Basic Editor) by pressing Alt+F11.
2. In the Project Explorer, double-click the ThisWorkbook Module.
3. From the Object dropdown list, select Workbook, and from the Procedure dropdown list, select BeforePrint (these two dropdown lists are at the top of the Module sheet).
4. In the Event procedure, between the automatically generated opening and closing statements, type the following code:

ActiveSheet.PageSetup.LeftFooter="&A&F&T&D" & ActiveWorkbook.Path

The letters A, F, T, D are the sheet name, workbook name, time, and date, respectively.
When using Excel 2002 and Excel 2003, the line of code will be shorter (Z is for the path address):
Screenshot // Adding the Path Address to the Header/Footer
Adding the Path Address to the Header/Footer


Leave a Reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.