I have a directory of excel files that interact with each other through VBA code in a master file.
I've never had a problem with this before, but after copying the whole directory to do some development work on the copy (keeping the original intact in a different location) I'm running into a "subscript out of range" problem when referencing the workbook.
For example, everything ran fine previously with this line of code (nothing in the actual code has been changed):
Code that now throws an error (never used to):
ScheduleLocation = Workbooks("Master Schedule").Path
However, this line now throws an error. If I replace "Master Schedule" with "Master Schedule.xlsm" everything works again. I've had this problem before, but I've never been able to put a finger on the root cause of the problem.
Code that doesn't throw an error:
ScheduleLocation = Workbooks("Master Schedule.xlsm").Path
Hence my question: why is this? Why would the name (without extension) be insufficient sometimes, and sometimes not?