Bonjour
Si je comprend bien , il me faut supprimer :
Chemin = "C:\Users\Nath\Desktop\CLIENTS\Facture"
et de le remplacer par :
Dim subFolder
subFolder = "Desktop\CLIENTS\Facture"
If LCase(Left(Application.OperatingSystem, 3)) = "win" Then
chemin = "\Users\" & Environ("USERNAME") & "\" & subFolder
Else
chemin = "/Users/" & Environ("USER") & "/" & Replace(subFolder,"\","/")
ce qui donne au resultat
Dim subFolder
subFolder = "Desktop\CLIENTS\Facture"
If LCase(Left(Application.OperatingSystem, 3)) = "win" Then
chemin = "\Users\" & Environ("USERNAME") & "\" & subFolder
Else
chemin = "/Users/" & Environ("USER") & "/" & Replace(subFolder,"\","/")
'Dossier = Sheets("Facture").Range("B1")
DateExtraction = Format(Now(), "yyyy-mm-dd")
ns = Sheets("Facture").Range("I13")
nsem = Sheets("Facture").Range("C13")
MkDir Chemin & "\" & Dossier
MkDir Chemin & "\" & Dossier & "\" & DateExtraction
For Each onglet In ThisWorkbook.Sheets
If onglet.Name = "Facture" Then
onglet.Select
nompdf = Chemin & " " & "N° " & ns & " " & "Du " & DateExtraction & " " & " " & nsem & " " & Dossier
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=nompdf & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End If
Next
End Sub
C'est cela qu il faut faire
En attente de reponse
NATH