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
| Option Explicit
Private Sub Worksheet_SelectionChange(ByVal R As Range)
If Not Intersect(R, [Tb[Résolu]]) Is Nothing And R.Count = 1 Then
Application.EnableEvents = 0
R = IIf(R = "o", "x", "o")
R(1, 2) = ""
If R = "x" Then
R(1, 2) = Now
If MsgBox("Voulez-vous envoyer un mail de résolution de l'incident?", vbYesNo, "Oui-Non") = vbYes Then
EnvoiMailFin
End If
End If
R(1, 2).Select
Application.EnableEvents = 1
End If
End Sub
Private Sub EnvoiMailFin()
Dim kR As Long
Application.ScreenUpdating = False
Application.DisplayAlerts = False
kR = ActiveCell.Row
With ActiveCell.Parent.MailEnvelope.Item
.To = Cells(kR, 3)
.Subject = "Résolution incident n°" & Cells(kR, 1) & "Outil " & Cells(kR, 2)
.Send
End With
MsgBox "Votre mail a été envoyé", vbInformation + vbOKOnly, "Pour info"
ThisWorkbook.Save
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub |
Partager