You can call a subroutine like the following:
Private Function GetModifiedTime(filespec) As String
Dim fs, f, s
Set fs = CreateObject("Scripting.Fi
Set f = fs.GetFile(filespec)
GetModifiedTime = Format(f.DateLastModified,
Set f = Nothing
Set fs = Nothing
End Function
This returns the date as a string, but you can just as easily convert it to a date with the CDate function. If you need the Date Created, simply replace the DateLastModified with DateCreated (DateLastModified is usually the standard).
Main Topics
Browse All Topics





by: shagerPosted on 2003-05-23 at 09:09:01ID: 8573036
Private Declare Function FileTimeToSystemTime Lib "kernel32" (lpFileTime As FILETIME, lpSystemTime As SYSTEMTIME) As Long
, LT)
e)
Private Declare Function FileTimeToLocalFileTime Lib "kernel32" (lpFileTime As FILETIME, lpLocalFileTime As FILETIME) As Long
Public Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Long
End Type
Function FileDate(FT As FILETIME) As String
' convert the FILETIME to LOCALTIME, then to SYSTEMTIME type
Dim ST As SYSTEMTIME
Dim LT As FILETIME
Dim t As Long
Dim ds As Double
Dim ts As Double
t = FileTimeToLocalFileTime(FT
t = FileTimeToSystemTime(LT, ST)
If t Then
ds = DateSerial(ST.wYear, ST.wMonth, ST.wDay)
ts = TimeSerial(ST.wHour, ST.wMinute, ST.wSecond)
ds = ds + ts
If ds > 0 Then
FileDate = Format$(ds, "mm/dd/yy hh:mm:ss")
Else
FileDate = "(no date)"
End If
End If
End Function
MsgBox FileDate(WFD.ftCreationTim
I finaly found my answer at MSN.