Inserting the Saved Date In a Header or Footer

Written by Allen Wyatt (last updated April 1, 2021)
This tip applies to Excel 97, 2000, 2002, and 2003


There may be times when you want your header or footer to contain the date of the last time that your workbook was saved. Normally, this is not information you can set in Excel. However, you can use the following macro to force the information into the proper place:

Sub MyFooter()
Dim mh As String
On Error Resume Next
mh = ActiveWorkbook.BuiltinDocumentProperties("Last Save Time")
If Err = 440 Then
   Err = 0
   mh = ActiveWorkbook.BuiltinDocumentProperties("Creation Date")
   If Err = 440 Then
      Err = 0
      mh = "Not Set"
   End If
End If
mh = Left(mh, 8)
ActiveSheet.PageSetup.LeftFooter = "Saved: " & mh
End Sub

There are a number of items to note in this macro. First of all, it attempts to determine the last date (and time) that the workbook was saved. If that information cannot be determined, then it extracts the date it was created. Finally, if that cannot be found, then it sets the footer to "Not Saved."

Notice that there is some error handling done in this macro. The reason is that Excel will return an error if a particular document property (BuiltinDocumentProperty in this case) is not set. The error needs to be intercepted and handled, which is done here.

You should note that this macro, once run, will set the left footer to the desired information. That information will not change again until you run the macro again. Thus, if you always want an up-to-date date in the footer, then you should either run the macro periodically (perhaps right before printing), or set it up to run whenever you open your document.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2055) applies to Microsoft Excel 97, 2000, 2002, and 2003.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Capitalizing Spring

According to the normal rules of grammar, the word "spring" is not supposed to be capitalized. There may be times, ...

Discover More

Understanding Single Line Spacing

Single line spacing, the default spacing used in a paragraph, allows Word to adjust the spacing of individual lines in a ...

Discover More

Finding Quoted Text in VBA

Macros are created for all sorts of purposes in creating, editing, and processing documents. You might want to use a ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (menu)

Adding Ampersands in Headers and Footers

Place an ampersand into the text of a page header or footer, and you might be surprised to see it missing in your ...

Discover More

Ampersands in Headers and Footers

Add an ampersand to the text in a header or footer and you may be surprised that the ampersand disappears on your ...

Discover More

Putting Cell Contents in Footers

Referencing information between cells in a worksheet is a piece of cake using some elemental formulas. You cannot, ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 + 0?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.