# VB Text File Date Modified?



## TedOlsen (Jan 6, 2002)

The code below gives me the Date and Time the file
was created. If another file with a newer date
gets copied over it, the date created stays the
same and only the date modified changes.

I need to get the Date & Time Modified. Does anyone
know how?

Thank you.


Sub ShowFileInfo(filespec)
Dim fs, f, s
Error_Flag = 0
On Error GoTo No_File
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
s = "Created: " & f.datecreated 'modified ' created
FilDate = f.datecreated
'FilDate = f.datemodified
'MsgBox s, vbSystemModal
GoTo Done
No_File:
On Error GoTo 0
Error_Flag = 1
Done:
End Sub


----------



## Rockn (Jul 29, 2001)

Something like this

s = "Created: " & f.datecreated
or
s = "Created: " & f.datelastmodified


----------



## TedOlsen (Jan 6, 2002)

Rockn,
Thank you very much.
That was the answer.
I had gressed at datemodified
but hadn't guessed datelastmodified

On line help seems to be of no help to me.
Do you have any suggestions for references?

Thanks again!!!
Ted


----------

