PDA

View Full Version : [SOLVED:] how to speed up processing string values from folder name and load into listbox



cropperaaron
01-14-2005, 07:21 AM
Does anyone know of a good way to read file system folders and populate a listbox with these names? I am currently using the following lines of code to do this and it works. However, it is very sluggish and was wandering what a better way to do this would be. Here is the code I am using:


Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(\\ohlew0010\plis\map83 (file://ohlew0010/plis/map83))
Set fc = f.Subfolders
For Each f1 In fc
'following line adds folder names to cmbStates listbox
cmbStates.AddItem (f1.Name)
Next

Any help is greatly appreciated!!

Jacob Hilderbrand
01-14-2005, 07:49 AM
File Scripting Object is what I use. You can try using Early Binding instead of Late Binding. Set a reference to the Microsoft Scripting Runtime (Tools | References).

Then instead of using CreateObject just use New.


Set fs = New FileSystemObject