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 33 34
| Sub Export_et_envoiPDF()
Dim AWkb As String
Dim o As Object
Dim m As Object
Application.EnableEvents = False
Application.DisplayAlerts = False
Range("B1:I47").Select
Sheets("Facturier").Copy
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs "f:\orgacoach\BackupFactures\Tmptmp.xlsb", 50, , , True
AWkb = ActiveWorkbook.Name
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\Syl\AppData\Local\Temp\Orgacoach.pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
DoEvents
Workbooks(AWkb).Close
Application.DisplayAlerts = True
Application.EnableEvents = True
Application.DisplayAlerts = True
Set o = CreateObject("Outlook.Application")
Set m = o.CreateItem(0)
m.To = Range("B16").Value
m.Subject = "Facture Orgacoach"
m.Body = "Ci-joint la facture pour " & Range("D24").Text & " " & Range("B24").Text & " " & Range("C24").Text
m.Attachments.Add "C:\Users\Syl\AppData\Local\Temp\Orgacoach.pdf"
'Repeat this line if there are more Attachments
m.Display
'm.Send 'If you want to just send it
End Sub |
Partager