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

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

You May Also Like

In this article, you will learn about the SKEW.P function, the formula syntax and usage of the function in Microsoft...
In this article, you will learn about the SKEW function, the formula syntax and usage of the function in Microsoft...
In this article, you will learn about the RANK.EQ function, the formula syntax and usage of the function in Microsoft...
  • Excel
  • November 23, 2021