Archive of Mr Excel Message Board


Back to Excel VBA archive index
Back to archive home

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?

Check out our Excel VBA Resources

Re: CREATEDATE in 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!


Re: CREATEDATE in Excel

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


Re: CREATEDATE in Excel

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


Ignore my first post

Posted by Ryan on July 06, 0100 1:52 PM
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


This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.