View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Problems with appilcation.filesearch

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

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jan Kronsell" wrote in message ...
Thanks Ron

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

Jan

"Ron de Bruin" skrev i en meddelelse
...
Hi Jan

You can try this
.Filename = ".xls"

Use Dir because there are problems with Excel XP

I have examples on my site
http://www.rondebruin.nl/copy3.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jan Kronsell" wrote in message

...
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