Would like file name to appear on all documents as a default.

M

Mrs. S

I would like to set up a default where all Excel documents automatically show
the file name when printed. Thanks!
 
B

Bob Phillips

Add this code to the ThisWorbook code module

Dim WithEvents AppClass As Application

Private Sub Appclass_WorkbookBeforePrint(ByVal Wb As Workbook, Cancel As
Boolean)
With Wb.ActiveSheet.PageSetup
.LeftFooter = Wb.FullName
End With
End Sub

Private Sub Workbook_Open()

Set AppClass = Application

End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
B

Bruce Sinclair

I would like to set up a default where all Excel documents automatically show
the file name when printed. Thanks!

You could try putting this formula in a cell (I use it at the top of the
sheet) and save it as your template (book.xls ? - depends on your version)
...

=CELL("filename",A1)

A1 can be any cell. The CELL function can provide other useful info too.

I usually add the date (=today()) but that means it will update every time
you open it (and you'll get a "save changes" mesage if you close it, even if
you haven't made any :) ).

HTH


Bruce

----------------------------------------
I believe you find life such a problem because you think there are the good
people and the bad people. You're wrong, of course. There are, always and
only, the bad people, but some of them are on opposite sides.

Lord Vetinari in Guards ! Guards ! - Terry Pratchett

Caution ===== followups may have been changed to relevant groups
(if there were any)
 
Top