Excel 97, get with VBA the date of creation of a workbook


Posted by Pierre on December 06, 2001 12:24 AM

Hello,

I am looking for a way to get in a Macro (Excel 97) the date of creation of a workbook. That date can be found manually clicking on 'Properties* of the workbook.
I am expecting sth as follows:
myDate = ActiveWorkbook.Date.Created
or myDate = ActiveWorkbook.Properties.CreationDate
but I just haven't been able to find my way through in the VBA help files.
Thanks!
Pierre

Posted by Colo on December 06, 2001 12:56 AM

Hi Pierre. I made a smple.
Please Try This.

Sub Get_CreationDate()
On Error Resume Next
Dim pDoc As DocumentProperty, intRow As Integer, myDate As Date
For Each pDoc In ActiveWorkbook.BuiltinDocumentProperties
If pDoc.Name = "Creation date" Then myDate = pDoc.Value
Next
MsgBox myDate
End Sub

Posted by Colo on December 06, 2001 1:31 AM

Woops! that's enough in the following code.

Sub Get_CreationDate2()
Dim myDate As Date
myDate = ActiveWorkbook.BuiltinDocumentProperties("Creation date").Value
MsgBox myDate
End Sub



Posted by Pierre on December 06, 2001 2:25 AM

Thanks Colo, it was exactly what I was looking for!

Thanks Colo, it was exactly what I was looking for!