Hello All,
I'm using the following FileSystemObject code to list and count the files in a given folder:
From here it seems easy enough to load the file list into an array for use in my program, and use the count for some other stuff I have planned, but can I use the FSO to be more selective and only grab files with a certain extension? Or do I have to use string manipulation on the file names once I've got them loaded into an array? Or is there some other/better approach than the FSO (which seems to otherwise work real well).
Thanks for any thoughts!
I'm using the following FileSystemObject code to list and count the files in a given folder:
Code:
Private Sub Command1_Click()
Dim fsoSysObj As New FileSystemObject
Dim fld1 As Folder, fld2 As Folder, strPath As String
Dim fil1 As File
Dim i As Integer 'counter variable
i = 0
strPath = App.path
Set fld1 = fsoSysObj.GetFolder(strPath)
For Each fil1 In fld1.Files
Debug.Print fil1.Name
i = i + 1
Next
End Sub
From here it seems easy enough to load the file list into an array for use in my program, and use the count for some other stuff I have planned, but can I use the FSO to be more selective and only grab files with a certain extension? Or do I have to use string manipulation on the file names once I've got them loaded into an array? Or is there some other/better approach than the FSO (which seems to otherwise work real well).
Thanks for any thoughts!