Jessica Stewart
Northern USA
Member
Members
Trusted Members
Trusted Members
Forum Posts: 219
Member Since:
February 13, 2021
February 13, 2021
Offline
A S
Member
Members
Forum Posts: 6
Member Since:
November 7, 2020
November 7, 2020
Offline
If you want to open last modified file in the folder, try below code
Sub openLastModified()
Dim FolderPath As String, tableName As String, latestTblName As String
Dim latestModified As Date, modifiedDate As Date
FolderPath = "path to your folder"
tableName = Dir(FolderPath & "*.xlsx")
'or use below line for any type of file
'tableName = Dir(FolderPath & "*")
Do While tableName <> vbNullString
modifiedDate = FileDateTime(FolderPath & tableName)
If latestModified < modifiedDate Then
latestModified = modifiedDate
latestTblName = tableName
End If
tableName = Dir()
Loop
Workbooks.Open FolderPath & latestTblName
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: G Thomas
Guest(s) 8
Currently Browsing this Page:
1 Guest(s)
1 Guest(s)
Top Posters:
Catalin Bombea: 1939
SunnyKow: 1432
Anders Sehlstedt: 919
Purfleet: 415
Frans Visser: 349
Hans Hallebeek: 339
David_Ng: 306
lea cohen: 248
Jessica Stewart: 219
A.Maurizio: 216
Newest Members:
santhosh kumar R
Lennard Wood
Miguel Costa
Nick Dowling
Silvia Ramos
Muhammad Abdullah Asad
Ifeanyi Aghanama
Ann Crossman
Kate Manders
James Carabott
Forum Stats:
Groups: 3
Forums: 25
Topics: 7069
Posts: 30981
Member Stats:
Guest Posters: 49
Members: 34461
Moderators: 2
Admins: 3
Administrators: Mynda Treacy, Philip Treacy, Jessica
Moderators: Velouria, Riny van Eekelen
© Simple:Press —