Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Application.FileSearch | Excel Discussion (Misc queries) | |||
What is better: Application.FileSearch or Dir ?? | Excel Programming | |||
Application.Filesearch | Excel Programming | |||
Application . filesearch doesn't work | Excel Programming | |||
VBA Application.FileSearch | Excel Programming |