Josh
Josh

Reputation: 265

How to return the Date Modified property?

I am setting up a system where we are scanning a single page to PDF and saving it to a specific folder.

I want to build an Excel spreadsheet that looks at the Date Modified property of the saved files in this particular folder and build my system based on when these files were saved.

I am not sure how to access this Date Modified property.

Upvotes: 0

Views: 663

Answers (1)

Francis Dean
Francis Dean

Reputation: 2476

You can access properties of a file using the Microsoft scripting runtime FileSystemObject class, including the date a file was last modified as shown below:

Sub GetDateCreated()

    Dim fileSysObj As Object: Set fileSysObj = CreateObject("Scripting.FileSystemObject")
    Debug.Print fileSysObj.GetFile("C:\myFile.txt").DateLastModified
    Set fileSysObj = Nothing

End Sub

Upvotes: 1

Related Questions