Private Sub CommandButton1_Click()
Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim StrBody As String
Dim derligne As Integer
Dim Mot(1 To 10) As String
If MsgBox("Confirmer l'ajout de la demande ?", vbYesNo, "Confirmation") = vbYes Then
' Remplir le tableau'
With Sheets("Demandes à traiter")
derligne = .Range("A5000").End(xlUp).Row + 1
.Cells(derligne, 2) = TextBox5.Value
.Cells(derligne, 1) = TextBox6.Value
.Cells(derligne, 3) = ComboBox2.Value
.Cells(derligne, 4) = ComboBox1.Value
.Cells(derligne, 5) = TextBox4.Value
Mot1 = .Cells(1, 1)
Mot2 = .Cells(1, 2)
Mot3 = .Cells(1, 3)
Mot4 = .Cells(1, 4)
Mot5 = .Cells(1, 5)
Mot6 = .Cells(derligne, 1)
Mot7 = .Cells(derligne, 2)
Mot8 = .Cells(derligne, 3)
Mot9 = .Cells(derligne, 4)
Mot10 = .Cells(derligne, 5)
End With
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)
StrBody = "bonjour , ci joint les données ..." & vbCrLf & vbCrLf & _
vbCrLf & Mot1 & " " & Mot2 & " " & Mot3 & " " & Mot4 & " " & Mot5 & vbCrLf _
& vbCrLf & Mot6 & " " & Mot7 & " " & Mot8 & " " & Mot9 & " " & Mot10
With olMail
.To = "aaa.bbb@toto.com"
.Subject = "Nouvelle demande"
.Body = StrBody
.Display
End With
Set olMail = Nothing
Set olApp = Nothing
End If
End Sub