- Option Explicit
-
- Public Function Verification_Chemin(strChemin As String) As Boolean
-
- Verification_Chemin = False
-
- If Trim(Dir(strChemin, vbDirectory)) <> "" Then
- Verification_Chemin = True
- End If
-
- End Function
-
- Public Sub Creation_Dossier(strChemin As String)
-
- Dim CheminPartiel As String
- Dim nbCarDebut As Integer
- Dim nbCar As Integer
-
- nbCarDebut = 4
- Retour1:
- nbCar = InStr(nbCarDebut, strChemin, "\")
- If nbCar <> 0 Then
- CheminPartiel = Left(strChemin, nbCar - 1)
- If Verification_Chemin(CheminPartiel) = False Then
- MkDir CheminPartiel
- nbCarDebut = nbCar + 1
- GoTo Retour1
- Else
- nbCarDebut = nbCar + 1
- GoTo Retour1
- End If
- Else
- MkDir strChemin
- End If
-
- End Sub
Option Explicit
Public Function Verification_Chemin(strChemin As String) As Boolean
Verification_Chemin = False
If Trim(Dir(strChemin, vbDirectory)) <> "" Then
Verification_Chemin = True
End If
End Function
Public Sub Creation_Dossier(strChemin As String)
Dim CheminPartiel As String
Dim nbCarDebut As Integer
Dim nbCar As Integer
nbCarDebut = 4
Retour1:
nbCar = InStr(nbCarDebut, strChemin, "\")
If nbCar <> 0 Then
CheminPartiel = Left(strChemin, nbCar - 1)
If Verification_Chemin(CheminPartiel) = False Then
MkDir CheminPartiel
nbCarDebut = nbCar + 1
GoTo Retour1
Else
nbCarDebut = nbCar + 1
GoTo Retour1
End If
Else
MkDir strChemin
End If
End Sub