1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Sub testt()
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Dim Ar(0) As String
Ar(0) = Feuil1.Name
Sheets(Ar).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\" & "Facture " & Range("A1") _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
Dim NomFichier As String
NomFichier = ThisWorkbook.Path & "\" & "Facture " & Range("A1") & ".pdf"
Set OutApp = CreateObject("outlook.application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = "bbbbb@yahoo.fr"
.Cc = ""
.Attachments.Add NomFichier
.Subject = "Sujet à définir"
.Body = "Vous trouverez ci-joint la facture ..."
.Display
End With
Set OutApp = Nothing
Set OutMail = Nothing
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub |