My VBA is not that good so apologies in advance. I have some vba code but cant get it to work based on filename with Wildcards. It just ignores the condition There are over 120 excel files but I only want xlsx files that begin with specific text an example would be All_Regions.xlsx and I am trying to get a hit from a partial filename using wildcards.
I can get it to work from a static name but the issue is each week the file name will be different: All_Regions_01012018 to All_Regions_08012018 and so on each week.
Any assistance would be greatly appreciated.
Example below:
Sub Testing()
OPCO = "All_re*.xlsx"
Source = "C:\files\All_OPCO\"
StrFile = Dir(Source)
If OPCO = StrFile Then
MsgBox ("Confirmed")
End If
End Sub