How can I show the file modification date in a page header?

R

rkriesel

How can I show the file modification date and time in a page header or footer?
 
G

Gord Dibben

You cannot get the "modified date" from an Excel workbook.

There is no "modified date" to grab.

When you open a workbook the modified date changes to current.

If you close the workbook with no changes or save, the modified date will
revert to last modified date which is last saved date.

Open Windows Explorer and find a workbook saved before today and note the
modified date,

Now open that workbook and View>Refresh in Windows Explorer.

Date will change to current.

Close the workbook without save and View>Refresh in WE.

Note date changes back to original.

To get last saved date you can use a macro like the following.

Sub printit()
ActiveSheet.PageSetup.RightHeader = "&8Last Saved : " & _
Format(ThisWorkbook.BuiltinDocumentProperties("Last Save Time"), _
"yyyy-mmm-dd hh:mm:ss")
End Sub


Gord Dibben MS Excel MVP

Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top