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
| Sub Alertes()
Dim B As Range, OL As Object, M As Object, Plage As Range
Set olApp = CreateObject("Outlook.application")
With Sheets("Service technique2")
Set Plage = .Range(.[H4], .Cells(.Rows.Count, 1).End(xlUp))
End With
For Each B In Plage
If B.Offset(, 5) - Date <= 70 Then
Set M = olApp.CreateItem(olMailItem)
With M
.Subject = "Alerte fin de validité d'habilisation BR"
.Body = B.Offset(, 19)
.Recipients.Add B.Offset(, 20)
.send
End With
End If
If B.Offset(, 8) - Date <= 70 Then
Set M = olApp.CreateItem(olMailItem)
With M
.Subject = "Alerte fin de validité Caces"
.Body = B.Offset(, 19)
.Recipients.Add B.Offset(, 20)
.send
End With
End If
If B.Offset(, 11) - Date <= 70 Then
Set M = olApp.CreateItem(olMailItem)
With M
.Subject = "Alerte fin de validité Formation SST"
.Body = B.Offset(, 19)
.Recipients.Add B.Offset(, 20)
.send
End With
End If
If B.Offset(, 14) - Date <= 70 Then
Set M = olApp.CreateItem(olMailItem)
With M
.Subject = "Alerte fin de validité Formation CHSCT"
.Body = B.Offset(, 19)
.Recipients.Add B.Offset(, 20)
.send
End With
End If
If B.Offset(, 17) - Date <= 70 Then
Set M = olApp.CreateItem(olMailItem)
With M
.Subject = "Alerte fin de validité FIMO - FCO"
.Body = B.Offset(, 19)
.Recipients.Add B.Offset(, 20)
.send
End With
End If
Next B
End Sub |
Partager