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
|
Sub Macro1()
'
' Macro1 Macro
'
'
Range("A1").Select
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\Temp\Classeur1.pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Application.Dialogs(xlDialogSendMail).Show
' Défini oMail en outlook.CreateItem(olMailItem)
Set oMail = Outlook.CreateItem(olMailItem)
'Paramétrage du mail
'Sujet du mail
oMail.Subject = "Envoi commande"
'Adresse de l'expéditeur
oMail.To = "prénom.nom@entreprise.fr"
'Texte du mail
oMail.Body = "Commande de fourniture" & vbCrLf & "Bonjour, Ci-joint commande de fourniture. "
'Pièce jointe (Qui doit être le meme chemin d'accès que dans 'Filename:=' plus haut pour le .pdf
oMail.Attachments.Add ThisWorkbook.Path & "\Commande.pdf"
'Envoi du mail
oMail.Send
'On vide les variables
Set oMail = Nothing
End Sub |
Partager