I am working on a VBA code to open a password protected excel file. The file name is includes the days date in it, however the naming convention is not always consistent - Sometimes days or months may have a leading 0 while other times they will not. For example the file's name for today could potentially be "12-04-2015" or "12-4-2015".
Is there a code that would open the file if it is saved in either "MM-DD-YYYY" or "MM-D-YYYY" format? Maybe incorporating a wildcard?
The code I currently have is:
Workbooks.Open Filename:= _
"C:\Operations\Reports\Testing\" & Format(Date, "MM-DD-YYYY") & ".xlsx", Password:="test"
Thank you!
Is there a code that would open the file if it is saved in either "MM-DD-YYYY" or "MM-D-YYYY" format? Maybe incorporating a wildcard?
The code I currently have is:
Workbooks.Open Filename:= _
"C:\Operations\Reports\Testing\" & Format(Date, "MM-DD-YYYY") & ".xlsx", Password:="test"
Thank you!