How to get the Created Time and Last Modified Time of your Excel Workbook using VBA Code ?

Do you want to retreive the created time and the last modified time of your Excel workbook and display it in the excel sheet ?

Here’s a code snippet demonstrating how you can display them in the cells B1 and B2 respectively.

How to get the Created Time and Last Modified Time of your Excel Workbook using VBA Code ?

1. Open Microsoft Visual Basic for Applications Window using the shortcu key “ALT + F11”.

2. Select Insert -> Module from the menu and paste the following VBA code snippet and press F5 to run it.

Sub GetData()
    ' SK - Get the dates
    Range("B1").Value = Format(ThisWorkbook.BuiltinDocumentProperties("Creation Date"))
    Range("B2").Value = Format(ThisWorkbook.BuiltinDocumentProperties("Last Save Time"))
End Sub

3. You should immediately see the Creation Date and Last Save Time in the cells B1 and B2 in the current active sheet.

image

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you’ll learn how to Find Blank cells in excel so that you can remove or delete the blank cells form...
In this article, you’ll learn what is a Gauge Chart in Microsoft Excel. Also, you will learn how to add...
Microsoft Excel provides a shortcut for the users to move columns in excel using two different ways – using Shift...