im using the filesystemobject to search for files in a folder and susbfolders then show these files in a listbox but when my form loads and executes the search the listbox fills with every file in the app.path how can i limit this to show .exe files and not everything else
heres my code im using
Code:
form load event
ListFolder App.Path
then in
Code:
Private Sub ListFolder(sFolderPath As String)
Dim FS As New FileSystemObject
Dim FSfile
Dim FSfolder As Folder
Dim subfolder As Folder
Set FSfolder = FS.GetFolder(sFolderPath)
For Each FSfile In FSfolder.Files
SelectionList.AddItem FSfile 'im sure i have to change this but its not having any of it
Next FSfile
For Each subfolder In FSfolder.SubFolders
Call ListFolder(subfolder.Path)
Next subfolder
Set FSfolder = Nothing
End Sub
ive tried to change the code to find .exe only but to no avail
thanks for any help