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 36 37 38 39
| Private Sub CommandButton1_Click()
'Updated by Extendoffice 2017/9/14
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Dim Conf As Integer
Dim Msg As String
On Error Resume Next
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
xMailBody = "Body content" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2"
On Error Resume Next
Msg = "Voulez-vous envoyer ce message ?"
Conf = MsgBox(Msg, vbYesNo + vbDefaultButton1, "Confirmation")
If Conf = "vbNo" Then
Cancel = "True ons"
End If
With xOutMail
.To = "pinguiin22@gmail.com"
.CC = ""
.BCC = ""
.Subject = "TEST"
.Body = "Bonjour, c'est LH"
.Display
.Send
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub |
Partager