I am having a problem with an application that I have written that uses multiple file searches. I do one file search at the beginning of the code execution in one file path and then I want to do another file search later in the execution in a different file path. I was testing my application and it was not performing as I expected. It was not finding the file I knew was in the directory of the second file search. While stepping through the code, I noticed that the .lookin value was not changing to the path after the “=” in my second .filesearch. I read in the help to use .newsearch to reset the .filesearch attributes, however it also states it does not reset the .lookin attribute.
Does anyone know how to get the second .filesearch to look in the new file path?
Here is a segment of the code.
With Application.FileSearch
.NewSearch
.LookIn = gstrArchive_Path
.Filename = mstrFile_Name
If .Execute > 0 Then
Exit Sub
End If
End With
The .lookin is not changing to the “gstrArchive_Path” when I step through the code. It is still pointing to the first file path on the first .filesearch.