I am using vba to try and locate a file that changes name ever so slightly each couple of days. This file is stored on a local intranet system.
The filename is always:
Food Specials Rolling Depot Memo xx - xx.xlsm
Where xx could represent a different week number e.g.
03 - 21
22 - 52
etc..
So one day the file may look like:
Food Specials Rolling Depot Memo 03 - 21.xlsm
The next day it may look like:
Food Specials Rolling Depot Memo 22 - 52.xlsm
Is there any way i could create 2 strings which contain all my week numbers, (i.e. 01 - 52) and test each of these at random within the file path like so:
WeekNumber1 = 1,2,3,4,5,6,7,8,9,10 etc.
WeekNumber2 = 1,2,3,4,5,6,7,8,9,10 etc.
Set wb = Workbooks.Open(sURL & "Food%20Specials%20Rolling%20Depot%20Memo%20" & WeekNumber1 & "%20-%20" & WeekNumber2 & ".xlsm")
MsgBox wb
On Error GoTo 0
Thanks
a proposition, as I am not sure that the dir() function does work on sharepoint/internet site
You can use the
Dir
function to iterate over all files matching your wildcard:Here is a simple way using
Like
: