Captain_Conman
Board Regular
- Joined
- Jun 14, 2018
- Messages
- 54
I am fairly new at VBA and am attempting to write a macro that references the most recent weekly report in a folder. My current code looks like this...
Workbooks.Open Filename:="S:\SherwinWilliams\Oracle Reports\6-13-2018.xlsx"
Windows("6-13-2018.xlsx").Activate
It works fine, however, later next week I will save a new report in the folder and want the macro to reference that report, and so on for weeks to come.
How can I tell my macro to reference the most recent report? Also, will I have to change my reference in the rest of my code? For example, will Windows("6-13-2018.xlsx").Activate have to change?
Thank you in advance for any help.
Workbooks.Open Filename:="S:\SherwinWilliams\Oracle Reports\6-13-2018.xlsx"
Windows("6-13-2018.xlsx").Activate
It works fine, however, later next week I will save a new report in the folder and want the macro to reference that report, and so on for weeks to come.
How can I tell my macro to reference the most recent report? Also, will I have to change my reference in the rest of my code? For example, will Windows("6-13-2018.xlsx").Activate have to change?
Thank you in advance for any help.