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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
Sub Tableau_auto_multi_selection_Simplifié()
Dim oitem As Outlook.MailItem
Dim corps_mail_HTML As String
Dim test_corps_mail As String
Dim texte_auto As String
Dim individualItem As Object 'liste des mail séléctionnés
Dim couleur_fond As String
Dim affectation As String
Dim x As String
Dim recherche_tableau As Double
On Error Resume Next
If ActiveInspector.CurrentItem Is Nothing Then
For Each individualItem In Application.ActiveExplorer.Selection
individualItem.Display
Set oitem = ActiveInspector.CurrentItem
On Error GoTo 0
corps_mail_HTML = oitem.HTMLBody
test_corps_mail = oitem.Body
'gestion des couleurs
couleur_fond = "#bfbfbf" 'gris
'controle si tableau déjà présent et ajoute tableau si non présent
recherche_tableau = InStr(1, test_corps_mail, "Action 1", vbBinaryCompare) 'recherche du tableau et renvoie la position dans le string
If recherche_tableau = 0 Then
'tableau de suivi au format HTML
texte_auto = " <style> " & _
".greeting-text { font-family: Calibri; font-size: 11pt; margin-bottom: 0;} " & _
".mail-body { margin-bottom: 0; }" & _
".table-class { border-collapse: collapse; margin-top: 0px; } " & _
".table-class td { border:1px solid #000000; width: 75px; height: auto; text-align: center; vertical-align: middle; font-weight: normal;} " & _
".table-class td.premiere_ligne { text-align: center; background:" & couleur_fond & "; width: 75px; font-weight: normal; } " & _
".table-class td.premiere_col { text-align: center; background:" & couleur_fond & "; width: 75px; font-weight: normal; } " & _
".table-class th { text-align: center; background: " & couleur_fond & "; border:1px solid #000000; width: 111px; height: 30px; text-align: center; vertical-align: middle;font-weight: normal; } " & _
"</style>" & _
"<div class='greeting-text mail-body'>Bonjour,<br><br><br><br></div>" & _
"<table class='table-class'>" & _
"<tr><th class='premiere_ligne'>Action 1</th>" & _
"<th>Action 2</th>" & _
"<th>Action 3</th>" & _
"<th>Action 4</th>" & _
"<th>Action 5</th>" & _
"<th>Action 6</th>" & _
"<th>Commentaires</th>" & _
"</tr><tr><td class='premiere_col'>Fait</td>" & _
"<td> </td><td> </td><td> </td><td> </td><td> </td><td> </td>" & _
"</tr><tr><td class='premiere_col'>Date</td>" & _
"<td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr></table>"
oitem.HTMLBody = texte_auto & corps_mail_HTML
End If
'sauvegarde et fermeture
oitem.Save
oitem.Close olDiscard
Next
End If
End Sub |
Partager