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.