Joe4
MrExcel MVP, Junior Admin
- Joined
- Aug 1, 2002
- Messages
- 74,140
- Office Version
- 365
- Platform
- Windows
I wrote some VBA code years ago for work that opens a bunch of files and runs some comparisons. The files have the same prefix every week, but different time stamps.
So this is the code the VBA code uses to open the files (first file):
(I should note, that there will only ever be one file in the folder matching the desired prefix)
This has worked for them for years. Now, they have some updates they want me to make. When I try to run this code (which works for them) on my computer, I get the following error:
If I run this version of the code, with the exact file name, it works as expected.
however, since the date/time stamp changes every week, I cannot do that.
I don't understand why the original code is no longer working on my computer. The only thing of note I can think of is I upgraded to Windows 11 recently.
Perhaps some system setting changed, messing things up? Anyone have any ideas?
So this is the code the VBA code uses to open the files (first file):
VBA Code:
Dim fName As String
fName = "C:\TEMP\Macros\Test\CMDB Server Report_*.xlsx"
Workbooks.Open Filename:=fName
This has worked for them for years. Now, they have some updates they want me to make. When I try to run this code (which works for them) on my computer, I get the following error:
If I run this version of the code, with the exact file name, it works as expected.
VBA Code:
Dim fName As String
fName = "C:\TEMP\Macros\Test\CMDB Server Report_20230901_0637.xlsx"
Workbooks.Open Filename:=fName
I don't understand why the original code is no longer working on my computer. The only thing of note I can think of is I upgraded to Windows 11 recently.
Perhaps some system setting changed, messing things up? Anyone have any ideas?