MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Displaying filenames automatically by default

Posted by Jeffry on December 28, 2000 5:09 AM

I want the filename to be automatically displayed on top of every sheet I print. I dont want to use it separately on all files. I want it to appear by default on all files in Excel so that I do not need to remember to do it on each file.


Posted by Ben O. on December 28, 2000 10:02 AM

You could create a macro that inserts the spreadsheet's name in the header before it prints it:

Sub PrintFileNames()
For Each Sh In Sheets
ActiveSheet.PageSetup.RightHeader = ActiveWorkbook.FullName
Next Sh
ActiveWorkbook.PrintOut Copies:=1
End Sub

You would have to use that macro to print your spreadsheets rather than selecting File > Print.

-Ben O.