ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Would like file name to appear on all documents as a default. (https://www.excelbanter.com/excel-discussion-misc-queries/68550-would-like-file-name-appear-all-documents-default.html)

Mrs. S

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

Bob Phillips

Would like file name to appear on all documents as a default.
 
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)

"Mrs. S" <Mrs. wrote in message
...
I would like to set up a default where all Excel documents automatically

show
the file name when printed. Thanks!




Bruce Sinclair

Would like file name to appear on all documents as a default.
 
In article , ?B?TXJzLiBT?= <Mrs. wrote:
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)



All times are GMT +1. The time now is 01:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com