rrhandle8
asked on
Find creation date of Excel Workbook
I am opening Excel workbooks use VBA in Access. I want to get the original creation date of the workbook, but what I am getting is the date is was moved to the current folder.
I tried using this, but it causes an error:
Access 2003
Excel 2010
Dim WkBk As Excel.Workbook
Set WkBk = ExcelApp.Workbooks.Open(filename:=WbkPathName)
WkBk.BuiltinDocumentProperties("Creation Date")
I tried using this, but it causes an error:
WkBk.BuiltinDocumentProperties.items("Creation Date").Value
Access 2003
Excel 2010
ASKER
ActiveWorkbook.BuiltinDocu mentProper ties("Crea tion Date") also returns today's date. Today is the day I saved it to my computer.
The original creation date is back in August, and can be seen on the Statistics tab of the property box.
The original creation date is back in August, and can be seen on the Statistics tab of the property box.
ASKER
CORRECTION -- The date on the Statistics tab is today's date. The date on the general tab is back in August.
Hi,
Maybe this quick guide help you:
http://spreadsheetpage.com/index.php/tip/determining_when_a_file_was_created/
-FA
Maybe this quick guide help you:
http://spreadsheetpage.com/index.php/tip/determining_when_a_file_was_created/
-FA
ASKER
I already tried that. Didn't work.
I have discovered the only way to get the original creation date is to use the FileSystemObject.
I have discovered the only way to get the original creation date is to use the FileSystemObject.
Option Compare Database
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
ASKER
I correct myself again. Even using the FSO, sometimes the original creation day is captured, other times it is not. Very confusing.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
There was no answer to this problem.
rrhandle8,
If you don't get your proper solution you can request for attention to this question and get points refund.
-FA
If you don't get your proper solution you can request for attention to this question and get points refund.
-FA
ActiveWorkbook.BuiltinDocu
Flyster