Я делал пример, но он не работает, да и забыл, куда бросил

Но вообщем до папки c:\windows\command он доходит но дальше - нет. VB утверждает, что Dir не может быть вызвана рекурсивно (хотя мой пример так и работает)...
Private Sub EnumFolders(Path As String, Optional where As Node)
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
Randomize
If where Is Nothing Then Set ndx = TreeView2.Nodes.Add(, tvwChild, Rnd(100000) & "key ", fsl1.Name) Else Set ndx = TreeView2.Nodes.Add(where.Key, tvwChild, Rnd(100000) & "key", fsl1.Name)
Сall EnumFolders(Path & "\" & fsl1.Name, ndx)
Next fsl1
For Each fsf1 In fsl.Files
If fsf1.Name Like Text1.Text Then
If where Is Nothing Then Set ndx1 = TreeView2.Nodes.Add(, tvwChild, , fsf1.Name) Else Set ndx1 = TreeView2.Nodes.Add(where.Key, tvwChild, , fsf1.Name)
ndx1.Bold = True
End If
Next fsf1
errhdl:
Select Case Err.Number
Case 76: MsgBox "Cannot read the drive "
End Select
Exit Sub
End Sub
Сейчас этот форум просматривают: Google-бот, SemrushBot, Yandex-бот и гости: 11