VBA_Debutant
New Member
- Joined
- Aug 5, 2011
- Messages
- 6
Hello,
My goal is to have Excel VBA open a file while I know almost all of the folder path where it's located, I'm just missing the full name of the last subfolder.
I have a folder path like "C:\Users\..." and the last subfolders to get to the file I want to open are consistently named "YYYY" (as is the year, like "2012") then "MM-..." (as in the month, like "07" and then something I don't know).
For example in the "2012" folder there is a "01.Jan" folder, a "02_feb-v1" folder, a "03-March" folder etc. I cannot rename the folders because they are in a shared location and I do not own them. But there is only 1 folder per month and in each of these folders there is an Excel file with the same name. I would like to access the file for a specific month with something simple like "Workbooks.Open" but it won't work with a wildcard in the middle of the file path.
Is it possible to have Excel VBA find and return the folder name in such a way that I can integrate it as a variable in my folder path?
I hope this makes sense. Thank you for your help.
My goal is to have Excel VBA open a file while I know almost all of the folder path where it's located, I'm just missing the full name of the last subfolder.
I have a folder path like "C:\Users\..." and the last subfolders to get to the file I want to open are consistently named "YYYY" (as is the year, like "2012") then "MM-..." (as in the month, like "07" and then something I don't know).
For example in the "2012" folder there is a "01.Jan" folder, a "02_feb-v1" folder, a "03-March" folder etc. I cannot rename the folders because they are in a shared location and I do not own them. But there is only 1 folder per month and in each of these folders there is an Excel file with the same name. I would like to access the file for a specific month with something simple like "Workbooks.Open" but it won't work with a wildcard in the middle of the file path.
Is it possible to have Excel VBA find and return the folder name in such a way that I can integrate it as a variable in my folder path?
I hope this makes sense. Thank you for your help.