vb: how to search, list files in folder with subfolder?
This site provides users with the information about vb, visual basic, vb6, search files in directory, subdirectory, list files in directory, subdirectory, search files in folder, subfolder, list files in folder, subfolder, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to search, list files in folder with subfolder?
The following is the code to search, list files in directory with subdirectory:
Please note that recursive function will be needed to go through the sub-directories.
Private Sub Command1_Click()
Private Sub SearchFolder(sFolderPath As String)
Dim fs As New FileSystemObject
Dim fsFolder As Folder
Dim sFolder As Folder
Set fsFolder = fs.GetFolder(sFolderPath)
For Each fsFile In fsFolder.Files
For Each sFolder In fsFolder.sFolders
Set fsFolder = Nothing