Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Noting the Workbook Creation Date.

Noting the Workbook Creation Date

by Allen Wyatt
(last updated December 6, 2014)

6

When you are developing a worksheet, you may need to keep track of certain information about your workbook. For instance, you might want to place the creation date of a workbook into a cell. While Excel does provide some worksheet functions for dates (such as NOW or TODAY), it does not provide a worksheet function to access the workbook creation date.

This means that the answer lies in using a macro. For instance, you might create a macro that would determine the current date and input it (as text) into a particular cell. This macro could then be run whenever you created a new workbook by naming the macro Auto_Open. The following is an example of such a macro:

Sub Auto_Open()
    If Worksheets.Application.Range("A1") = "" Then
        Worksheets.Application.Range("A1") = Format(Date, "long Date")
    End If
End Sub

The macro checks to see what is in cell A1. If there is nothing there, then it puts the text version of today's date in there. If there is something already there (which there would be every time you subsequently open the workbook), then the information is left intact and unscathed.

Perhaps the most satisfactory approach, however, is to actually access the operating system and pull the file creation date for the current workbook. This can be done with the following macro function:

Function CreateDate() As String
    Dim Temp As String

    On Error Resume Next
    Temp = CreateObject("scripting.filesystemobject"). _
      GetFile(ActiveWorkbook.Name).dateCreated
    If Err.Number <> 0 Then
        CreateDate = "Not Saved"
    Else
        CreateDate = Left(Temp, InStr(Temp, " ") - 1)
    End If
    On Error Goto 0
End Function

Notice that this approach isn't tied to a particular cell in your worksheet. To use the macro, simply put the following in any cell of your worksheet:

=CreateDate()

The function returns either "Not Saved" (if the workbook is brand new and hasn't been saved before) or it returns a text value that represents the date on which the workbook was created.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10234) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Noting the Workbook Creation Date.

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

Renaming a Workbook

Renaming a workbook from within Excel can seem daunting, but it is actually quite easy. All you need to do is use the Open ...

Discover More

Printing a Draft Watermark

Adding a watermark to the background of a printout can be challenging. This tip explains the different ways you can implement ...

Discover More

Saving a Workbook in a Macro

Does your macro need to make sure that the workbook being processed is saved to disk? You can add the saving capability by ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Printing Workbook Properties

Want to create a printed record of the properties associated with a workbook? There is no easy way to do it in Excel. Here's ...

Discover More

Creating a Workbook Clone

If you are afraid of messing up a workbook, consider doing your work on a clone of the workbook. Excel provides an easy way ...

Discover More

Discovering Dependent Workbooks

When you starting linking information from one workbook to another, those workbooks become dependent on each other. ...

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}] 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?

2015-10-13 12:20:45

3R

Can someone provide the definitions for the following?
Created
Modified
Accessed
While the definitions seem evident, I need to prove when a document was saved to the server. Does the Created definition provide the evidence?


2014-12-09 12:03:54

Glenn Case

Also, to answer Paul's question:

ActiveWorkbook.BuiltinDocumentProperties("Last Save Time")


2014-12-09 12:01:27

Glenn Case

This is easier, as you don't need to use scripting. TO access the creation date from VBA, use the following:

ActiveWorkbook.BuiltinDocumentProperties("Creation Date")


2014-12-07 13:35:57

David Harte

(For Paul) I haven't confirmed this but I'm pretty sure that to retrieve when the workbook file was last SAVED the same basic macro can be used but with the Temp variable set to the 'dateLastModified' property instead of the 'dateCreated' property (oh, and the name of the macro no doubt changed to call it SaveDate or something similar).


2014-12-06 07:39:25

sheldon hopkins

An easier (and more informative) method

Add a worksheet to your workbook. In this version history worksheet:
col a date of editing workbook
col b version (incremental)
col c module affected
col d brief description of change

Now you have a record of your workbook's history


2014-12-06 07:03:42

Paul Van den Bossche

Interesting tip !
But ... Is there a way to put the (time and) date in a cel that tells when the sheet was SAVED the last time ?

thanks in advance !


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu 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.