Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default foundfiles bad result

Hallo newsgroup,
i have a problem with the application.filesearch.foundfiles command.
sometimes i get a wrong result. instead of two files (which are in the
directory) i get zero or one as result.
if i use instead of
.Filename = "*.xls"
.Filename = "*.*"
it takes a lot of time (nearly 30 seconds before the ".execute"
command comes to an end), but the result is ok. if i run the orign
code afterwards the result for .Filename = "*.xls" is correct too.

Here is the code that provokes wrong results:

With fs
.NewSearch
.LookIn = xlsPath
.SearchSubFolders = False
.Filename = "*.xls"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
If .Execute() 0 Then
For j = 1 To .FoundFiles.Count
...

Any idea
Thanks in advance
Lars
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default foundfiles bad result

Lars,
FileSearch has a bad reputation. You have found out why.
The Dir function can replace it as long as you don't need to
search thru sub-folders...
'--

'Adds file names from the directory path into an array
Function LoadThemUp(ByRef sFileArray() As String, ByRef sDir As String) As Byte
Dim sFile As String
Dim x As Long
ReDim sFileArray(1 To 500) 'arbitrary

'All the types you want to see
sFile = Dir(sDir, vbNormal + vbSystem + vbHidden)

Do While LenB(sFile)
x = x + 1
sFileArray(x) = sFile
sFile = Dir()
Loop
ReDim Preserve sFileArray(1 To x)
End Function
--
Jim Cone
Portland, Oregon USA



"tonto96"

wrote in message
Hello newsgroup,
i have a problem with the application.filesearch.foundfiles command.
sometimes i get a wrong result. instead of two files (which are in the
directory) i get zero or one as result.
if i use instead of
.Filename = "*.xls"
.Filename = "*.*"
it takes a lot of time (nearly 30 seconds before the ".execute"
command comes to an end), but the result is ok. if i run the orign
code afterwards the result for .Filename = "*.xls" is correct too.
Here is the code that provokes wrong results:

With fs
.NewSearch
.LookIn = xlsPath
.SearchSubFolders = False
.Filename = "*.xls"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
If .Execute() 0 Then
For j = 1 To .FoundFiles.Count
...
Any idea
Thanks in advance
Lars
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
FoundFiles Sprinks Excel Programming 2 October 23rd 06 04:08 PM
removing the file extension while listing files via foundfiles Jon[_21_] Excel Programming 7 April 15th 06 10:17 PM
Using FoundFiles to list by path and filename Jon[_21_] Excel Programming 2 April 15th 06 06:41 PM
Using .FoundFiles to list files by path and file name Jon[_21_] Excel Programming 0 April 12th 06 04:45 AM
.Foundfiles Question Shane Excel Programming 5 November 24th 05 04:46 AM


All times are GMT +1. The time now is 02:40 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"