Creation Date of Excel File

There are two ways to get the creation date of a file...one using the filesystem object for any file (opened or not) and other is through workbook's buitin properties. Paste the following in a general module of a workbook test run it by running the ExecuteFunc procedure in the same module. Alternatively, you can download the attachment file.
Option Explicit
Function getCreationDate(strCompleteFilePath As String) As Date
Dim objFileSystem As Object
Dim objFile As Object
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
If objFileSystem.FileExists(strCompleteFilePath) Then
Set objFile = objFileSystem.GetFile(strCompleteFilePath)
getCreationDate = objFile.DateCreated
Else
MsgBox "The specified file '" & strCompleteFilePath & "' does not exist.", vbInformation, "Creation Date"
End If
Set objFile = Nothing
End Function
Function getOpnWbkCreationDate(wbkOpened As Workbook) As Date
getOpnWbkCreationDate = wbkOpened.BuiltinDocumentProperties("Creation Date")
End Function
Sub ExecuteFunc()
MsgBox getCreationDate(ThisWorkbook.FullName)
MsgBox getOpnWbkCreationDate(ThisWorkbook)
End Sub
| Attachment | Size |
|---|---|
| FileCreationDate_1.xls | 31 KB |
- Vishesh's blog
- Add new comment
- 1736 reads

Recent comments
11 hours 10 min ago
18 hours 28 min ago
21 hours 20 min ago
21 hours 25 min ago
1 day 12 hours ago
1 day 12 hours ago
1 day 22 hours ago
2 days 14 hours ago
3 days 14 hours ago
3 days 14 hours ago