Dim S() As String, i As Byte, Cesta As String
If Len(D) < 3 Then Exit Function
S = Split(D, "\")
If UBound(S) = 0 Then Exit Function
Cesta = S(0)
On Error GoTo KONIEC
For i = 1 To UBound(S)
Cesta = Cesta & "\" & S(i)
If Len(Dir(Cesta, vbDirectory)) = 0 Then MkDir Cesta
Next i
KONIEC:
Create_Dir_Structure = Err.Number = 0
End Function
Sub pokus()
Dim disk As String, slozka As String
disk = "C:"
slozka = "slozkaDomy"
If Not Create_Dir_Structure(disk & "\" & slozka & "\systemObsazen1") Then
MsgBox "Chyba. Adresár nebol vytvorený.", vbCritical
Exit Sub
End If
End Subcitovat