RockandGrohl
Well-known Member
- Joined
- Aug 1, 2018
- Messages
- 790
- Office Version
- 365
- Platform
- Windows
UGH, I'VE WRITTEN OLDEST, I MEANT NEWEST.
Hello, I'm writing some code to look into a folder and find the oldest named folder. Our folders are structured like this:
2023-01
2022-12
2022-11
2022-10
etc
But because folders can have different creation & modification dates, these can't be relied on to produce a chronological order.
Is there a simple way to determine the folder with the newest date, by name, which I can then insert into this workbook.open command?
Thank you!
Hello, I'm writing some code to look into a folder and find the oldest named folder. Our folders are structured like this:
2023-01
2022-12
2022-11
2022-10
etc
But because folders can have different creation & modification dates, these can't be relied on to produce a chronological order.
Is there a simple way to determine the folder with the newest date, by name, which I can then insert into this workbook.open command?
VBA Code:
Workbooks.Open "C:\Users\" & uname & "\[redacted company name]\Reporting - Documents\[redacted customer name]\Reporting\Mobile\[redacted supplier name]\>>FOLDER MONTH NAME GOES HERE\TargetWorkbook.xlsx"
Thank you!