Subscribe to our YouTube Channel for more Videos

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

Senthil Kumar B
Senthil Kumar is a former Microsoft MVP (Most Valuable Professional). He is a Co-Author of the book "Windows 10 Development Recipes using JavaScript and CSS" for Apress Publication. He is a technical presenter, blogger, mentor and a Geek.  Senthil is a regular speaker is various local user groups. He has presented at conferences like Great Indian Developer Summit (GIDS) & Microsoft DevCamps. You can reach out to him via his Twitter handle @isenthil.