Public Function GetDate(rng)
Dim FileName As String
Dim DSO As Object
If TypeName(rng) = "Range" Then
If rng.Cells.Count > 1 Then
GetDate = CVErr(xlErrRef)
Exit Function
End If
FileName = rng.Value
Else
FileName = rng
End If
Set DSO = CreateObject("DSOleFile.PropertyReader")
With DSO.GetDocumentProperties(sfilename:=FileName)
GetDate = .DateCreated
End With
End Function
Call like
=GetDate(A1)
or
=GetDate("C:\myTest\volker1.xls")
You do need to have the DSO dll installed and registered?
You can use the File System Object(FSO) 's File (object) in Vba Code to
get a File Such as "DateCreated","DateLastAccessed","DateLastModified"...
attributes.
So you can get any File 's "DateCreated" Attribute to fill in worksheet's
"B1".
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.