To Capture Last modified date of the file
If you want to capture last modified date of any file, you can use below code.Sub test()
Dim fso As Object, myDir As String, fn As String, myFile As String, myDate As Date, maxDate As Date
Set fso = CreateObject("Scripting.FileSystemObject")
myDir = "C:\temp"
fn = Dir(myDir & "\*.csv)
Do While fn <> ""
myDate = fso.GetFile(myDir & "\" & fn).DateLastModified
If maxDate < myDate Then
myFile = fn
maxDate = myDate
End If
fn = Dir()
Loop
MsgBox myDir & "\" & fn & " : " & maxDate
End Sub
Regards:
KK Bhardwaj
info@bhardwajweb.com
kk43man@gmail.com
+91-9816464547
+91-9736399339
Bhardwaj Web Solutions
www.bhardwajweb.com
Himachal Pradesh
No comments:
Post a Comment