View Full Version : populate a text box (or something) with a list of files...


Atomic Shrimp
03-01-2001, 07:22 AM
Can somebody tell me the easiest way to get a box on my form that displays a list of files in a given folder (perhaps files of a given type too), I don't need to be able to select them or anything, I just need to be able to see when an incoming files folder is full enough to make a processing job worthwhile.

If it involves activex objects, please can you give me the idiots guide...

Thanks

Mike

llkhoutx
03-01-2001, 07:31 AM
Find some code which will give you all the folders in a folder in a table or an array. then use that tables as the recordsource for a listbox.

The code is relatively trivial. Get a copy of Litwin's Acess 97 Developer's Handbook, see page 645 in particular.

Here it is:

Sub SimpleSearch()
' Perform simple search using the FileSearch object.
Dim varItem As Variant
With Application.FileSearch
.FileName = "*.ini"
.LookIn = "C:\WINDOWS"
.SearchSubFolders = True
.Execute
For Each varItem In .FoundFiles
Debug.Print varItem
Next varItem
End With
End Sub

Atomic Shrimp
03-06-2001, 12:40 AM
Thanks, that works quite nicely.

it does return the entire path and filename, so I've had to use InStr to find the last '\' and chop off the right hand part of the string to get just the filename.