MrExcel Publishing
Your One Stop for Excel Tips & Solutions

CREATEDATE in Excel


Posted by Robert Kelly on July 06, 2000 10:35 AM

In Word, I can insert a field that inserts a CREATEDATE macro which displays the creation date of the document. Is there an equivilant function for Excel?

Posted by craig on July 10, 0100 7:17 AM

Ryan,

The first line of code generates the error
'user-defined type not defined' do you know how to resolve this?

Craig

Here is some code that will take care of what you need. Let me know how it works!

Posted by Ryan on July 10, 0100 12:14 PM

Craig,

You must set a Reference to the Microsoft Runtime Scripting Library for this code. To do this, in the VBE, go to Tools --> References and find this Library and check it. It should work from here. Let me know!
Ryan

Posted by Ryan on July 06, 0100 1:49 PM

Robert,

Here is some code that will take care of what you need. Let me know how it works!

Ryan

Sub GetDateCreated()
' This requires a Reference to Microsoft Runtime Scripting Library
Dim FSO As Scripting.FileSystemObject
Dim FileItem As Scripting.File

Set FSO = New Scripting.FileSystemObject
Set FileItem = FSO.GetFile(ActiveWorkbook.Path & "\" & ActiveWorkbook.Name)

End Sub

Posted by Ryan on July 06, 0100 1:52 PM

Ignore my first post

Robert,
Here is the correct code. I left the key thing out in the other post. Let me know how it works!
Ryan

Sub GetDateCreated()
' This requires a Reference to Microsoft Runtime Scripting Library
Dim FSO As Scripting.FileSystemObject
Dim FileItem As Scripting.File
Dim DateCreated As String

Set FSO = New Scripting.FileSystemObject
Set FileItem = FSO.GetFile(ActiveWorkbook.Path & "\" & ActiveWorkbook.Name)
DateCreated = FileItem.DateCreated

End Sub