VBA Retrieving Date from Text File Properties

I am trying to capture the date when a specific text file was downloaded to a computer. The date is not in the actual text file, instead you must right-click, then go to properties to view the date. I need to read the date in a variable.

I don’t know where to start to do this.

Thank,

Jesse Huntermon

+3
source share
1 answer

If the built-in is FileDateTime()not yours after you can use FSO:

Dim FSO As Object: Set FSO = CreateObject("Scripting.FileSystemObject")
Dim objFile As Object: Set objFile = FSO.Getfile("C:\bleep\bloop.file")

Debug.Print "Date created: " & objFile.DateCreated
Debug.Print "Date last accessed: " & objFile.DateLastAccessed
Debug.Print "Date last modified: " & objFile.DateLastModified

If its date in the extended attribute checks this out.

+6
source

All Articles