Sub testo()
'selection et copy dans nveau classeur de la Feuille active et modèle(2)
'debut essai boucle
For Each ws In Worksheets
If Len(ws.Name) = 6 And IsNumeric(ws.Name) Then
'debut macro sans la boucle
Sheets(Array(ActiveSheet.Name, "modèle (2)")).Copy
Application.DisplayAlerts = False
Sheets("modèle (2)").Select
ActiveWindow.SelectedSheets.Visible = False
' Le chemin du fichier en cours : ThisWorkbook.Päth
ActiveWorkbook.SaveAs Filename:= _
ThisWorkbook.Path & "\" & "FactMat - " & Range("H8").Text & " - " & ActiveSheet.Name & " - " & Range("J79").Text & ".xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
Application.ActivePrinter = "Sowedoo PDF 4 sur Ne00:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Sowedoo PDF 4 sur Ne00:"
'Envoi mail
Set MonOutlook = CreateObject("Outlook.Application")
Set MonMessage = MonOutlook.CreateItem(0)
With MonMessage
ad = Range("j3").Value
'corps = Range("j4").Value
If ad <> "" Then .to = ad
.Subject = "Facturation"
.Body = "Bonjour," & vbCrLf & "ci-joint votre facture"
.attachments.Add "D:\Data\" & "FactMat - " & Range("H8").Text & " - " & ActiveSheet.Name & " - " & Range("J79").Text & ".pdf" ', FileFormat:= _"
.display
End With
'Fin envoi mail
ActiveWindow.Close
FileCopy "D:\Data\" & "FactMat - " & Range("H8").Text & " - " & ActiveSheet.Name & " - " & Range("J79").Text & ".pdf", ThisWorkbook.Path & "\" & "FactMat - " & Range("H8").Text & " - " & ActiveSheet.Name & " - " & Range("J79").Text & ".pdf"
Kill (ThisWorkbook.Path & "\" & "FactMat - " & Range("H8").Text & " - " & ActiveSheet.Name & " - " & Range("J79").Text & ".xls") ', FileFormat:= _"
Kill ("D:\Data\" & "FactMat - " & Range("H8").Text & " - " & ActiveSheet.Name & " - " & Range("J79").Text & ".pdf")
Application.DisplayAlerts = True
'fin macro sans la boucle
End If
Next
'fin de la boucle (les 2 dernières lignes)
End Sub