Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Problems with appilcation.filesearch

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Problems with appilcation.filesearch

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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Problems with appilcation.filesearch

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






  #4   Report Post  
Posted to microsoft.public.excel.programming
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








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filesearch in VB6 Colin Charman Excel Programming 3 June 18th 04 04:18 PM
FileSearch Stephen[_6_] Excel Programming 8 June 12th 04 11:14 PM
FileSearch using VBA Mark[_31_] Excel Programming 2 December 24th 03 05:49 PM
.FileSearch Randall[_3_] Excel Programming 4 November 26th 03 01:48 AM
FileSearch Problem Nigel[_4_] Excel Programming 4 October 11th 03 03:43 PM


All times are GMT +1. The time now is 06:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"