Problems with appilcation.filesearch

J

Jan Kronsell

I have the following code:

Set fs = Application.FileSearch
With fs
.LookIn = "C:\test"
.Filename = "*.xls"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
Workbooks.Open Filename:=.FoundFiles(i)
Sheets(1).Range("a1").Value = 10
ActiveWorkbook.Save
ActiveWorkbook.Close
Next i
Else
MsgBox "There were no files found."
End If
End With

One one pc it works allright, but on another i does not. One thje not
working one I get

Runtime error '1004'
Method 'Filesearch' of object '_application' failed

Both runs Win XP and Excel XP and both has the same refrences set.

Does anyone know, what could be the problem?

Jan
 
J

Jan Kronsell

Thanks Ron

I'll look into it, but do you have any idea., why this function works
different on different pc'

Jan
 
R

Ron de Bruin

Hi Jan

I read about this problem in the newsgroup a lot and have also
problems myself with it when I want to search zip files.

Dir is always working
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top