Hi All,
I am trying to find an excel with file name starting with specific text in a folder and if it is found then execute some series of commands. Below is the code I've attempted.
>>> use code - tags <<<
A1 range in sheet 1 has the path of the folder where the file needs to be searched. "SKU360" is the text with which the file name starts. The above code doesn't go to the else commands even though there is an excel with filename starting with "SKU360". What am I doing wrong.
I am trying to find an excel with file name starting with specific text in a folder and if it is found then execute some series of commands. Below is the code I've attempted.
>>> use code - tags <<<
Code:
Set fso = CreateObject("Scripting.filesystemobject")
sSFolder = Worksheets("Sheet 1").Range("A1").Value
sFile = "*SKU360*"
If Not fso.fileexists(sSFolder & "\" & sFile) Then
Sheets("Industry").Select
Else
Workbooks.Open Filename:=sSFolder & "/" & sFile
Last edited by a moderator: