Dim S(), Pocet As Long
Private Sub UserForm_Initialize()
Dim FSO As Object, fsoAdresar As Object
Const Cesta = "C:\2017\"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set fsoAdresar = FSO.getFolder(Cesta)
Call ZoznamSuborov(fsoAdresar)
Set FSO = Nothing: Set fsoAdresar = Nothing
If Pocet > 0 Then ListBox1.List = S
End Sub
Sub ZoznamSuborov(ByRef fsoAdresar As Object)
Dim fsoSubor As Object, fsoPodAdresar As Object, PocS As Long
With fsoAdresar
PocS = .Files.Count
If PocS > 0 Then
ReDim Preserve S(1 To Pocet + PocS)
For Each fsoSubor In .Files
Pocet = Pocet + 1
S(Pocet) = fsoSubor.Path
Next fsoSubor
End If
For Each fsoPodAdresar In .subFolders
Call ZoznamSuborov(fsoPodAdresar)
Next fsoPodAdresar
End With
Set fsoPodAdresar = Nothing: Set fsoSubor = Nothing
End Sub
Pridávam radšej aj prílohu...