I've developed something similar to what you are asking for, but it's probably overkill for what you are wanting to do. So instead of pasting a hundred plus lines of code, here is a quick mockup showing the basics:
Code:
Private Sub Command0_Click()
Dim oFSO As New FileSystemObject
Dim sDir As String
Dim oFolder As Folder
Dim oFile As Scripting.File
' Create Folder object specified by what is in the TextBox
sDir = Nz(Me.txtDirectory.Value, "")
Set oFolder = oFSO.GetFolder(sDir)
' Clear the ListBox and populate it from the Files in the Folder
Me.lstFiles.RowSource = ""
For Each oFile In oFolder.Files
Me.lstFiles.AddItem (oFile.Path)
Next oFile
End Sub
Private Sub lstFiles_Click()
Dim sFilePath As String
' Open the Selected File
sFilePath = Nz(Me.lstFiles.Value, "")
If Len(sFilePath) > 0 Then FollowHyperlink (sFilePath)
End Sub
You'll need to include Microsoft Scripting Runtime as a reference to the Visual Basic project. Also, if you want the links to look like hyperlinks, you can set format of the ListBox to have the text color of blue and underlined.
Comment