Cyberax » 15.09.2006 (Пт) 10:53
Я уже нашел решение вот если кому надо
Sub dirTest()
Dim dlist As New Collection
Dim startDir As String
Dim i As Integer
startDir = "startDir"
Call FillDir(startDir, dlist)
MsgBox "there are " & dlist.Count & " in the dir"
For i = 1 To dlist.Count
Debug.Print dlist(i)
Next i
End Sub
Sub FillDir(startDir As String, dlist As Collection)
Dim strTemp As String
Dim colFolders As New Collection
Dim vFolderName As Variant
strTemp = Dir(startDir)
Do While strTemp <> ""
dlist.Add startDir & strTemp
strTemp = Dir
Loop
strTemp = Dir(startDir & "*.", vbDirectory)
Do While strTemp <> ""
If (strTemp <> ".") And (strTemp <> "..") Then
colFolders.Add strTemp
End If
strTemp = Dir
Loop
For Each vFolderName In colFolders
Call FillDir(startDir & vFolderName & "\", dlist)
Next vFolderName
End Sub