Date file created

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
 
W

WhytheQ

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
 
B

Bob Phillips

'-----------------------------------------------------------------
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)
 
L

Les Stout

Hi Bob, please excuse the ignorance, but how do i call the function or
get it to give me what i need...

Les Stout
 
B

Bob Phillips

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)
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top