Results 1 to 2 of 2

Thread: Open the most recent file in a folder of files with the default program?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Posts
    2,295

    Open the most recent file in a folder of files with the default program?

    Hi there folks. I am working on a program for students to do their classroom work at home. Anyway, I have weekly newsletters of what they will be learning for the week. I use shellexecute open them, for example..

    ShellExecute Me.hwnd, "open", App.Path & "\ResourceFiles\WorkActivities\WeeklyNewsletters\\WeeklyNewsletter-" & lblDate.Caption & ".pdf", vbNullString, vbNullString, SW_SHOWNORMAL

    However, what I would like to do, is have it open the most recent newsletter in the folder. The folder has only newsletters, but I would like the program to just open the most recent one.

    Would anyone know how to get the shellexecute to look at the date created or modified for the files and use that to decide which one is the newest downloaded into the folder?

    Thanks!

  2. #2
    PowerPoster
    Join Date
    Feb 2017
    Posts
    5,700

    Re: Open the most recent file in a folder of files with the default program?

    With the Dir function you can get the names of the files in the folder, and with FileDateTime you can get the date.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width