File Date in Excel Footers

G

Guest

Guest
How can I get the file save date to print automatically in the footer of a worksheet? Since I can do this in Word, I'm sure it should be able to be done in Excel 97. Any ideas?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi
Try going to View, Header & Footer...,Custom Footer, and click the icon that looks like calendar pages. (This is Excel 2000 but I think 97 is very similar)
regards
Derek
 
Upvote 0
Derek....thanks, but that puts the current date/time, not the date/time the file was last saved.
 
Upvote 0
You can run a macro like this:

Sub myFoot()
detl = FileDateTime(ActiveWorkbook.FullName)
ActiveSheet.PageSetup.LeftFooter = detl
End Sub

You can change LeftFooter to CenterFooter or Right Footer.

You'd need to refresh this before Printing.

HTH. Cheers, Nate
This message was edited by NateO on 2002-02-28 12:31
 
Upvote 0
Place the above code in a normal module.
Now on the sheet in question, right-click on the tab and select "view code." Paste the following code in there.


Private Sub Workbook_BeforePrint(Cancel As Boolean)
application.run("myFoot")
End Sub


This page footer should refresh automatically before you print.

Cheers, Nate
 
Upvote 0
The code works for me if I manually run the macro, but it did not automatically refresh before I printed.

I right-clicked on the tab, clicked view code, and entered:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Application.Run ("FileSaveDate")
End Sub

(Note: I changed the name of the macro to FileSaveDate)

As I said above, if I manuall run the macro and then print, it works. But it did not automatically refresh when I printed. What am I missing and/or doing wrong? (I am running Excel 2002 SP3)
 
Upvote 0
It's past Nate's bedtime. I think he meant to say place the code in the ThisWorkBook module. RightClick the Excel icon to the left of the word "File" on the menu bar and choose "View Code". Nate, why not the whole thing in the WB module?
Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetUp.LeftFooter = BuiltInDocumentProerties("Last Save Time")
End Sub

lenze
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,150
Members
448,552
Latest member
WORKINGWITHNOLEADER

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top