VBA Excel 2000 - File Date Modified

Dear Experts,

I have a short code which assign a certain file name to a variable

Dim FileNev As String
FileNev = "D:\PR\Conv " & FileNap & "." & modMilyenHonap & ".xls"

Is it possible through Excel VBA to get that file last Date Modified attribute? So the date which can be seen in Windows Explorer as last modified

thanks,
LVL 1
csehzIT consultantAsked:
Who is Participating?
 
Rory ArchibaldConnect With a Mentor Commented:
You can use:
FileDateTime(FileNev)

Open in new window

0
 
Jorge PaulinoIT Pro/DeveloperCommented:
0
 
Jorge PaulinoConnect With a Mentor IT Pro/DeveloperCommented:
Example:

Dim fso As New FileSystemObject
Dim f As File

Dim FileNev As String
FileNev = "D:\PR\Conv " & FileNap & "." & modMilyenHonap & ".xls"
Set f = fso.GetFile(FileNev)

MsgBox f.DateLastModified
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
With this code you need to add references to Microsoft Scripting Runtime

rorya formula is easier but this way is more flexible (you can get more information about the file)
0
 
csehzIT consultantAuthor Commented:
Thanks very much both versions, it works great
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.