Sub EnumFolders(Path As String, aList As ListBox)
On Error GoTo errhdl
Dim fso As FileSystemObject
Dim fsl As Folder
Dim fsl1 As Folder
Dim fsf1 As File
Dim ndx As Node
Dim ndx1 As Node
Set fso = New FileSystemObject
Set fsl = fso.GetFolder(Path & "\")
For Each fsl1 In fsl.SubFolders
aList.additem fsl1.path
Call EnumFolders(Path & "\" & fsl1.Name, aList)
Next fsl1
For Each fsf1 In fsl.Files
aList.additem fsf1.path
End If
Next fsf1
errhdl:
Select Case Err.Number
Case 76: MsgBox "Cannot read the drive.", vbCritical Or vbOKOnly, "Test"
End Select
Exit Sub
End Sub
Sub EnumFolders(Path As String, aList As ListBox, Mask As String)
For Each fsf1 In fsl.Files
if fsf1.name like mask then aList.additem fsf1.path
End If
Next fsf1
Сейчас этот форум просматривают: Yandex-бот и гости: 8