Quote Originally Posted by sheeeng
The program cannot work, Execution time seem halted. How?
How many files have you got? I could only take one tenth of a second even on the windows directory files.

ANyway, this code is 20-30% quicker than the other guy's in my tests. You need to set a reference to the Microsoft Scripting Runtime library


Dim oFSO  As Scripting.FileSystemObject
Dim oFolder As Folder, oFile As File
Set oFSO = CreateObject("Scripting.FilesystemObject")
    Set oFolder = oFSO.getfolder("c:\windows")
For Each oFile In oFolder.Files
        ListBox1.AddItem oFile.Name
    Next oFile