Hi everyone,
I am having an issue with the following code, which is intended to retrieve the file's last modification date (I'm only showing the most relevant lines for the sake of brevity):
The code is retrieving the date when the file was first created, not when it was last modified. And even if I delete the file File.txt and / or replace it with a newly created one with the same name, it is still displaying the date when the first file was created.
Since this code snippet is inside a for loop ("File.txt" is actually a different name in every loop) I made sure I set to nothing both oFS and f at the end of each loop, but the result is the same.
Any ideas on what I may be doing wrong? All suggestions will be more than welcome.
NOTE: This even happens if I break the loop and try to retrieve a single file's last modified date.
I am having an issue with the following code, which is intended to retrieve the file's last modification date (I'm only showing the most relevant lines for the sake of brevity):
Code:
Set oFS = CreateObject("Scripting.FileSystemObject")
Set f = oFS.GetFile("C:\Users\Me\File.txt")
MsgBox CStr(DateValue(f.DateLastModified))
Since this code snippet is inside a for loop ("File.txt" is actually a different name in every loop) I made sure I set to nothing both oFS and f at the end of each loop, but the result is the same.
Any ideas on what I may be doing wrong? All suggestions will be more than welcome.
NOTE: This even happens if I break the loop and try to retrieve a single file's last modified date.
Last edited: