Option Explicit
Private Declare Function SHCreateDirectoryEx Lib "Shell32.dll" Alias "SHCreateDirectoryExA" _
(ByVal hwnd As Long, ByVal pszPath As String, ByVal lngsec As Long) As Long
Public t As Double, i&, nomdeb$, Rep$, chemin$, derl&
Private Sub CreationDossier(sNomRep As String)
SHCreateDirectoryEx 0&, sNomRep, 0&
End Sub
Sub Creer_Dossier()
Sheets(1).Activate
derl = ActiveSheet.Range("A65536").End(xlUp).Row
On Error Resume Next
For i = 2 To derl
Application.GoTo ActiveSheet.Range("N" & i)
nom = ActiveSheet.Range("N2:N" & i )
nomdeb = "C:\" & nom
Rep = "\DeskTop"
CreationDossier nomdeb & Rep & "\"
chemin = nomdeb & Rep & "\"
Next i
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
chemin & "Scanning.pdf", Quality:= xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
End Sub