I am able to display all files from a folder into a listbox but I want to make it so that system or hidden files do not show up. How can i do this.
Here is my code to display the files:
Private Sub GetDir(sDrive As String)
On Error Resume Next
Dim strRowSource As String
Dim crt
Dim file
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
Set crt = FSO.GetFolder(sDrive)
'Files
For Each file In crt.Files
strRowSource = strRowSource & file.Name & ";"
Next
Me!lstFiles.RowSource = strRowSource
End Sub
Thanks,
Marcin
Here is my code to display the files:
Private Sub GetDir(sDrive As String)
On Error Resume Next
Dim strRowSource As String
Dim crt
Dim file
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
Set crt = FSO.GetFolder(sDrive)
'Files
For Each file In crt.Files
strRowSource = strRowSource & file.Name & ";"
Next
Me!lstFiles.RowSource = strRowSource
End Sub
Thanks,
Marcin