Find creation date of Excel Workbook

Posted on 2014-01-01
Medium Priority
Last Modified: 2014-01-16
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.

Dim WkBk As Excel.Workbook
Set WkBk = ExcelApp.Workbooks.Open(filename:=WbkPathName)
WkBk.BuiltinDocumentProperties("Creation Date")

Open in new window

I tried using this, but it causes an error:

WkBk.BuiltinDocumentProperties.items("Creation Date").Value

Open in new window

Access 2003
Excel 2010
Question by:rrhandle8
  • 5
  • 3
LVL 22

Expert Comment

ID: 39750412
If it's the active workbook, try this:

ActiveWorkbook.BuiltinDocumentProperties("Creation Date")


Author Comment

ID: 39750421
ActiveWorkbook.BuiltinDocumentProperties("Creation 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.

Author Comment

ID: 39750448
CORRECTION -- The date on the Statistics tab is today's date.  The date on the general tab is back in August.
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

LVL 14

Expert Comment

by:Farzad Akbarnejad
ID: 39750516

Author Comment

ID: 39750572
I already tried that.  Didn't work.
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
        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

Open in new window


Author Comment

ID: 39750612
I correct myself again.  Even using the FSO, sometimes the original creation day is captured, other times it is not.  Very confusing.
LVL 14

Accepted Solution

Farzad Akbarnejad earned 1000 total points
ID: 39750730
I tested a bit a few hours ago. If you create file using Mouse Right Click then using new excel file command of opened context menu you will have a wrong creation date field!.


Author Closing Comment

ID: 39784078
There was no answer to this problem.
LVL 14

Expert Comment

by:Farzad Akbarnejad
ID: 39784679
If you don't get your proper solution you can request for attention to this question and get points refund.


Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
I tried to use the SharePoint app to Import a Spreadsheet and import an Excel sheet into a Team site made in SharePoint 2016. But that just resulted in getting an error message 'Unknown Error'...
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question