Date file created

  • Thread starter Thread starter Les Stout
  • Start date Start date
L

Les Stout

Good day all, i need to get the date a file was created, is this
possible ? All i can find is date last modified.. Any help with code
would be appreciated

Les Stout
 
I see something by Tom that should help

Sub AAACCC()
Dim fso As Object
Dim f As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.Drives("A").RootFolder.Files("aa_Userform.xls")
Debug.Print f.Name
Debug.Print "Created: " & f.DateCreated
Debug.Print "Last Accessed: " & f.DateLastAccessed
Debug.Print "Last Modified: " & f.DateLastModified
End Sub

Rgds
J
 
'-----------------------------------------------------------------
Function DocProps(prop As String)
'-----------------------------------------------------------------
Application.Volatile
On Error GoTo err_value
DocProps = ActiveWorkbook.BuiltinDocumentProperties _
(prop)
Exit Function
err_value:
DocProps = CVErr(xlErrValue)
End Function


and enter in a cell such as
=DocProps ("last author")
or
=DocProps ("creation date")


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Hi Bob, please excuse the ignorance, but how do i call the function or
get it to give me what i need...

Les Stout
 
Les,

You can call it from a worksheet

=DocProps ("creation date")

or within other code

madeDate = DocProps ("creation date")

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
As Bob said, in a cell:

=DocProps ("creation date")


from VBA

dim v as Variant
v = DocProps("creation date")
if iserror(v) then
msgbox "Problems"
else
msgbox "Results are " & v
End if
 
Back
Top