Filling a listbox with filenames, then opening the one selected

daninthemix

Registered User.
Local time
Today, 14:12
Joined
Nov 25, 2005
Messages
41
Hey all,

I need for a listbox to look in a folder and populate itself with all files in that folder, and then open the file the user dbl-clicks on.

Does anyone have this to hand?

I found a thread referencing another thread with code for listing a directory, but that thread was invalid (not there anymore...).
 
Here is a way to fill your listbox.

Code:
Private Sub Form_Load()
    Dim LoadFiles   As String
    Dim strFill     As String
    
    LoadFiles = Dir$("c:\dev\*.*")
    Do While LoadFiles > ""
       strFill = strFill & LoadFiles & ";"
       LoadFiles = Dir$
    Loop
    lstFiles.RowSource = strFill
End Sub
 

Users who are viewing this thread

Back
Top Bottom