Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Mar 2001
    Location
    Indiana, USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    .Filesearch problem (2000)

    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.

  2. #2
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: .Filesearch problem (2000)

    Mark

    Maybe you can try to change the Excel current directory by doing something like:

    ChDrive gstrArchive_Path and then a ChDir gstrArchive_Path.

    I looked into the MSKB and did not find anything useful, but you may want to look at <font color=blue> Q259738 </font color=blue>

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  3. #3
    New Lounger
    Join Date
    Mar 2001
    Location
    Indiana, USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: .Filesearch problem (2000)

    Wassim,

    Thanks for the tip. It did work. It is just curious that the .lookin did not change to the new file path after I explicitly set it equal to another file path.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •