ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filesearch 1004 error with XL 2003 (https://www.excelbanter.com/excel-programming/333871-filesearch-1004-error-xl-2003-a.html)

[email protected][_2_]

Filesearch 1004 error with XL 2003
 
Has anyone come across the problem of Filesearch causing an 1004 error
message. Running the compiler doesn't cause a problem. The macro stops it's
on the line:
Set fs = application.filesearch

The error message is: method 'filesearch' of object '_application' failed.
This doesn't seem to be the usual problems using the filesearch command. I'm
using XL 2003 (11.6355.6360) SP1 with Win XP

Many thanks

James

dim fs
dim i as integer

Set fs = Application.FileSearch
With fs
.LookIn = "c:\"
.FileName = "*.xls"
.SearchSubFolders = True

If .Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending)
0 Then


For i = 1 To .FoundFiles.Count
debug.print .foundfiles(i)
next i
end if
end with




Toppers

Filesearch 1004 error with XL 2003
 
FYI - your code ran OK for me (XL2003 with XP Home).

" wrote:

Has anyone come across the problem of Filesearch causing an 1004 error
message. Running the compiler doesn't cause a problem. The macro stops it's
on the line:
Set fs = application.filesearch

The error message is: method 'filesearch' of object '_application' failed.
This doesn't seem to be the usual problems using the filesearch command. I'm
using XL 2003 (11.6355.6360) SP1 with Win XP

Many thanks

James

dim fs
dim i as integer

Set fs = Application.FileSearch
With fs
.LookIn = "c:\"
.FileName = "*.xls"
.SearchSubFolders = True

If .Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending)
0 Then


For i = 1 To .FoundFiles.Count
debug.print .foundfiles(i)
next i
end if
end with





All times are GMT +1. The time now is 04:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com