|
Dim eachSheet as Worksheet
For Each eachSheet In Application.Worksheets
With eachSheet.PageSetup .CenterHeader = BuiltinDocumentProperties("Title").Value .RightFooter = "Last Updated: " & BuiltinDocumentProperties("Last Save Time").Value .LeftFooter = ThisWorkbook.FullName End With
Next eachSheet
HTH Vern
OK, this is working pretty well:
Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.CenterHeader = BuiltinDocumentProperties("Title").Value ActiveSheet.PageSetup.RightFooter = "Last Updated: " & BuiltinDocumentProperties("Last Save Time").Value ActiveSheet.PageSetup.LeftFooter = ThisWorkbook.FullName End Sub
I am still buggered by the macro warning, but I haven't had time to check out Walden's suggestion of digital/self signing thoroughly. I tinkered with the idea of creating an add-in, as Excel suggests might avoid the warning, but again, no time to look into it yet.
This morning, I opened an existing .xls with this Workbook_BeforePrint setup working and printed on Friday, did a Save As to a new name, and edited the worksheet. I had done this several times last week, and the Workbook_BeforePrint functioned as expected. Today, though, I copied several sheets within the same .XLS. I saved the workbook, then printed the "entire workbook" so that all the sheets would print together. The Workbook_BeforePrint only updated the last sheet printed which, FWIW, was the active sheet at the time of printing. All of the other sheets had the information from the .xls that I opened before doing the Save As.
I noticed that there is also Workbook_BeforeSave. It seems that these functions need to run _AfterSave, but I don't see that one in the list of "subs". Maybe SheetActivate?
Suggestions / advice are greatly appreciated!
db
-- This is the PC Technical Discussion for iSeries Users (PcTech) mailing list To post a message email: PcTech@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/pctech or email: PcTech-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/pctech.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.