LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default .filesearch trouble

I am using the following code to conduct a filesearch and write the files
found to an array:

k = 0
For i = 1 To UBound(myFolders)
With Application.FileSearch
.NewSearch
.LookIn = myFolders(i)
.SearchSubFolders = False
.FileName = "*.csv"
If .Execute() 0 Then
ReDim Preserve filelist(1 To k + .FoundFiles.COUNT)
For j = 1 To .FoundFiles.COUNT
k = k + 1
filelist(k) = .FoundFiles(j)
Next j
Else
MsgBox "There were no files found."
End If
End With
Next i

The code works well only the first time run after restarting excel.
However, if I have already run the code, then add files to any previously
selected paths, the code only sees the files that were there during the
first execution of the code?

Any ideas?

Smokii
 
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 12:35 AM.

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

About Us

"It's about Microsoft Excel"