I use Application.FileSearch codes to find a file in any folder. But the result isn't exactly. See following codes.
With Application.FileSearch
.LookIn = StrDirName
.filename = StrFileName
If .Execute() <= 0 Then
SeekFilesInDir = False
Exit Function
End If
SeekFilesInDir = True
End With
The problem is: I want to search the the file "ABC.txt". But if "ABC123.txt" or " or other files which name includes the "ABC" string in this folder. The returned variable "SeekFilesInDir" should be "TRUE".
Is there any good codes can solve the problem?
With Application.FileSearch
.LookIn = StrDirName
.filename = StrFileName
If .Execute() <= 0 Then
SeekFilesInDir = False
Exit Function
End If
SeekFilesInDir = True
End With
The problem is: I want to search the the file "ABC.txt". But if "ABC123.txt" or " or other files which name includes the "ABC" string in this folder. The returned variable "SeekFilesInDir" should be "TRUE".
Is there any good codes can solve the problem?