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
| ' envoie un mail avec la pièce jointe
MsgBox "You will be prompted with an alert message, please press the allow button to confirm the sending of the mail."
'Working in Excel 2000-2013
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.to = Range("B33")
.CC = ""
.BCC = "xxx@xxx.com"
.Subject = "Thank you Card"
.Body = "Somebody from xxx company thought about you and wanted to tell you thank you"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing |
Partager