Solved

Find creation date of Excel Workbook

Posted on 2014-01-01
9
1,479 Views
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
0
Comment
Question by:rrhandle8
  • 5
  • 3
9 Comments
 
LVL 22

Expert Comment

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

ActiveWorkbook.BuiltinDocumentProperties("Creation Date")

Flyster
0
 

Author Comment

by:rrhandle8
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.
0
 

Author Comment

by:rrhandle8
ID: 39750448
CORRECTION -- The date on the Statistics tab is today's date.  The date on the general tab is back in August.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 14

Expert Comment

by:Farzad Akbarnejad
ID: 39750516
0
 

Author Comment

by:rrhandle8
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
    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

Open in new window

0
 

Author Comment

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

Accepted Solution

by:
Farzad Akbarnejad earned 500 total points
ID: 39750730
Hi,
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!.

-FA
0
 

Author Closing Comment

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

Expert Comment

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

-FA
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

831 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