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!
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.