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
| Sub Mail_workbook_Outlook_1()
'Working in Excel 2000-2016
'This example send the last saved version of the Activeworkbook
'For Tips see: <a href="http://www.rondebruin.nl/win/winmail/Outlook/tips.htm" target="_blank">http://www.rondebruin.nl/win/winmail/Outlook/tips.htm</a>
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 = "phti@ia.ca"
.CC = ""
.BCC = ""
.Subject = Range("B5").Value
.Body = "Bonjour, ci-joint la demande informatique."
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
MsgBox "Votre demande a bien été transmise."
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub |
Partager