Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


list files modified after a date/time

list files modified after a date/time

list files modified after a date/time

can somebody help me how to create a simple and fast running filesearch that returns a list of files last modified after a ceratin date/time?
I found .LastModified function which did not help me because it looks like I have to use this MsoLastModified constants.
Search will not run regulary (sometimes after one week or after two days or after 3 months). Therefore I save the date of last search and want to find later on all files modified after.

RE: list files modified after a date/time


What application are you using?

What do you mean by, "Search will not run regulary?"  Do you have code that you have used?  If so, please post.

Please answer ALL these questions.


glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: list files modified after a date/time

sorry for beeing not precise enough!
I'm still VBA beginner.

I'm using Microsoft EXCEL 2003.
With "Search will not run regulary" I mean that there are no fixed times when the script will run. It will be started manually in variable times.
Thats why the MsoLastModified constants are not suitable for me. I'd like to compare last modified date of found files with the date in Worksheets(1).Cells(1, 1) filled by last execution of the macro (to list only the new files after last run).
Here my filesearch - without any date comparisation becaus I don't know how:
    With Application.FileSearch
        .LookIn = "D:\project\"
        .Filename = "*.pdf"
        .SearchSubFolders = True
        If .Execute > 0 Then
            msgbox("There were " & .FoundFiles.Count & _
            " file(s) found.")
            Worksheets(1).Cells(1, 1).Value = Date()
            For i = 1 To .FoundFiles.Count
                Worksheets(1).Cells(1+i, 1).Value = .FoundFiles(i)
            Next i
            MsgBox "There were no files found."
        End If

    End With

RE: list files modified after a date/time

Try using the FileSystemObject.  The File object has a DateLastModified Property that you can compare to the date in your sheet.


glassesJust traded in my old subtlety...
for a NUANCE!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close