Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Problems with Application.FileSearch

I ran your code repeatedly and each time it found the correct number of
files. That said, I have in the past had my own problems with FileSearch
not returning all the files I thought it should and I consider it to be
unreliable. I prefer the tried and true Dir method.

--
Jim
"kristinaol" wrote in message
...
I am trying to search for a bunch of files using Application.FileSearch.
Sometimes it works, but mostly it doesn't. It is as if some variable is
not
cleared, that the result from an old search is still in memory, and no new
search is performed when I try to run the script again. Does anyone have
any
ideas what is wrong?

The code looks as follows:
(Variables files and no_of_files are declared earlier)

With Application.FileSearch
.NewSearch
.LookIn = Path
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
ReDim files(1 To .FoundFiles.Count)
no_of_files = .FoundFiles.Count
Else
MsgBox "There were no files found."
Exit Sub
End If
End With



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
Application.FileSearch Cleberton(Brazilian) Excel Discussion (Misc queries) 2 October 26th 09 01:21 PM
What is better: Application.FileSearch or Dir ?? WhytheQ Excel Programming 9 October 25th 06 01:29 PM
Application.Filesearch EA Excel Programming 3 August 17th 06 10:07 AM
Application . filesearch doesn't work somethinglikeant Excel Programming 1 June 16th 06 06:42 PM
VBA Application.FileSearch Roger Frye Excel Programming 0 March 5th 04 04:07 AM


All times are GMT +1. The time now is 02:35 PM.

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"