Thursday, 7 June 2007

Printing the Workbook Path in a Header


Some people find printing the workbook's name in a footer helpful. Doing so creates a quick reference for the file's location on your printout. However, there's no built-in feature for printing the file's name, but you can do so with a simple macro. To create this macro, open the VB Editor by clicking Alt-F11. Then, select the correct project in the Project window (which you'll find in the upper-left corner). Next, select Insert, Module. In that module, enter the following procedure:
Sub NameInFooter() ActiveSheet.PageSetup.LeftFooter = ActiveWorkbook.FullName End sub
To close the VB Editor, simply click the Close button at the top-right corner of your screen.
When you're ready to run the macro, choose Tools, Macro. Then, choose Macros again, select NameInFooter, and click Run. You won't see the effects immediately. If you click the Print Preview button, you can see the filename in the footer.

No comments:

Analytics and Statistic

Blog Archive