Hi all,
I have a listbox that with the push of a button shows me all the files in the folder. The path is hard coded. I would like to avoid hard code all the folders so when I push a button, it shows the files from that folder.
Is there a way the code could be adjusted so it would show the folders and files in one listbox like below:
Folder1
file1
file2
Folder2
file1
file2.
This is the code I have now:
Code:
Private Sub Command23_Click()
Dim LoadFiles As String
Dim strFill As String
LoadFiles = Dir$("C:\Messages\*.*")
Do While LoadFiles > ""
strFill = strFill & LoadFiles & ";"
LoadFiles = Dir$
Loop
List21.RowSource = strFill
End Sub
greetings.