locked
Application.FileSearch in Excel 2003 RRS feed

  • Question

  • Hi,

    I have a VBA macro that has been run on many different computers.  It uses Application.FileSearch to search for specific files in a folder.  The .Execute command returns 0 ( for no files found ) on one particular computer.  However the same files and same macro when run on other computers works just fine.  Here is my code:

        For a = intLowerArrayVal To intUpperArrayVal
            strSearchCrit = strSearchCrit & strSearchArray(a) & ";"
           
            With Application.FileSearch
                
                .NewSearch
                .LookIn = strDataDirectory
                .Filename = strSearchArray(a)

                intExecuteResult = .Execute   ' Execute will execute the FileSearch to see if the
                                              ' file exists.  > 0 for success, 0 for file not found.
               
                If intExecuteResult > 0 Then ...

     

    I am stumped.  I have no idea whey this will work on many computers but not on this one machine.

    Any help would be greatly appreciated.

    Thanks,

    Kent

     

    Monday, January 26, 2009 7:41 PM