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 40 41 42 43 44 45 46 47 48 49
|
Sub examen()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Dim i As Integer
Dim N As Integer
Dim Msg, Subj, Msgbody As String
Msg = Msg & "Bonjour," & vbCrLf
Msg = Msg & vbCrLf
Msg = Msg & "Voici les résultats de l'évaluation n°" & Cells(14, 10) & " de la semaine dernière." & vbCrLf
Msg = Msg & "Bon courage"
Msg = Msg & vbCrLf
Subj = Subj & vbCrLf
Subj = Subj & "..." & vbCrLf
Subj = Subj & "..." & vbCrLf
Subj = Subj & "..." & vbCrLf
Subj = Subj & "..." & vbCrLf
Subj = Subj & "..." & vbCrLf
N = Cells(11, 10)
N = N + 1
For i = 2 To N
Msgbody = Msgbody & "<table>"
Msgbody = Msgbody & "<tr><td>" & Cells(1, 2).Value & "</td><td>" & Cells(1, 3).Value & "</td><td>" & Cells(1, 4).Value & "</td><td>" & Cells(1, 5).Value & "</td><td>" & Cells(1, 6).Value & "</td><td>" & Cells(1, 7).Value & "</td><td>" & Cells(1, 8).Value & "</td></tr>"
Msgbody = Msgbody & "<tr><td>" & Cells(i, 2).Value & "</td><td>" & Cells(i, 3).Value & "</td><td>" & Cells(i, 4).Value & "</td><td>" & Cells(i, 5).Value & "</td><td>" & Cells(i, 6).Value & "</td><td>" & Cells(i, 7).Value & "</td><td>" & Cells(i, 8).Value & "</td></tr>"
Msgbody = Msgbody & "</table>"
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = Cells(i, 1)
.Subject = "Resultats évalutations n°" & Cells(14, 10)
.Body = Msg
.bodyHTML = Msgbody
.Body = Subj
.Send
End With
Next
End Sub |
Partager