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: 1
Default Finding files in a directory


Hi, I'm having a problem, not sure if it's VBA related or if there'
something wrong with my system. I have the following code:


Code
-------------------

Sub test()
Set fs = Application.FileSearch
With fs
.NewSearch
.FileType = msoFileTypeExcelWorkbooks
.LookIn = "\\directory\"
.Filename = "3000333*"
If .Execute 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub

-------------------


It looks into a specific directory, and tells me how many file
beginning with 3000333 there are in that folder. I have over a thousan
files in the folder, 13 of which begins with 3000333. However, accordin
to this code, it only finds 10. However, if i just use .Filename = "*.*
, that is, search for all the files in the directory, then I get all th
files, including the three that did not appear.

Here are the 13 files that should appear:
30003330x051206.XLS
30003332x051606.XLS
30003333x071206.XLS
30003334x071206.XLS
30003335x021706.XLS
30003335x040706.XLS
30003337x041006.XLS
30003337x061506.XLS
30003338x042506.XLS
30003339x012506.XLS
30003339x021606.XLS
30003339x022306.XLS
30003339x031606.XLS

However, the code does not find 30003333x071206.XLS
30003334x071206.XLS, and 30003337x041006.XLS.
Any suggestions

--
farfu
-----------------------------------------------------------------------
farful's Profile: http://www.excelforum.com/member.php...fo&userid=3617
View this thread: http://www.excelforum.com/showthread.php?threadid=56263

 
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
finding internal links in excel directory Mominator Excel Discussion (Misc queries) 0 September 13th 07 02:56 AM
Finding the last modified directory and file [email protected] Excel Programming 1 October 18th 05 11:15 PM
Files in a directory? Greg B Excel Discussion (Misc queries) 5 May 11th 05 09:46 PM
Renaming all files in a directory Jan Kronsell[_3_] Excel Programming 4 February 19th 04 12:33 PM
Check if directory empty OR no of files in directory. Michael Beckinsale Excel Programming 2 December 4th 03 10:12 PM


All times are GMT +1. The time now is 11:42 PM.

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"