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 35
| Sub Envoi_Mail()
Dim appOutlook As Outlook.Application
Dim message As Outlook.MailItem
Dim myRecipient As Object
'Lance une session Microsoft Outlook
Set appOutlook = CreateObject("outlook.application")
'Crée un nouveau message
Set message = appOutlook.CreateItem(olmailItem)
Sheets("Running bookings").Select
ThisWorkbook.ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\Bookings_transfer"
ActiveWorkbook.Close
With message
'Titre, Texte, Destinataires, Pièces jointes du message
.Subject = "Running Forecast"
.Body = "Veuillez trouver ci-joint le Running Forecast du mois dernier." & Chr(13) & "Sincères Salutations, " & Chr(13) & "Olivier Chapeau"
.bodyFormat = olFormatHTML
.Recipients.Add ("Toto")
.Attachments.Add ActiveWorkbook.FullName
'Envoie le message
.send
End With
'Quitte l'application Outlook
appOutlook.Quit
'Réinitialise l'objet
Set appOutlook = Nothing
End Sub |
Partager