PDA

View Full Version : Outlook 365 display message on replyAll mailitem event



zx10
10-02-2023, 09:46 AM
I have tried putting the code in ThisOutlookSesssion mailitem send, reply and reply all and cant even hit a break point

Any help greatly appreciated!

Private Sub mailItem_Reply(ByVal Response As Object, Cancel As Boolean)
Dim msg As String
Dim result As Integer
If myMailItem.Recipients.Count > 1 Then
msg = "Do you really want to reply to one?"
result = MsgBox(msg, vbYesNo, "Reply Check")
If result = vbNo Then
Cancel = True
End If
End If
End Sub

Private Sub mailItem_ReplyAll(ByVal Response As Object, Cancel As Boolean)
Dim msg As String
Dim result As Integer
If myMailItem.Recipients.Count > 1 Then
msg = "Do you really want to reply to one?"
result = MsgBox(msg, vbYesNo, "Reply Check")
If result = vbNo Then
Cancel = True
End If
End If
End Sub

Private Sub mailItem_Send(Cancel As Boolean)
Dim result As Integer
If myMailItem.Recipients.Count > 1 Then
msg = "Do you really want to reply to one?"
result = MsgBox(msg, vbYesNo, "Reply Check")
If result = vbNo Then
Cancel = True
End If
End If
End Sub

Aussiebear
10-02-2023, 01:05 PM
Welcome to VBAX zx10. When posting code to the forum please wrap your code with code tags. See the first line in my signature as a hint. Secondly, there is no need to double space between your lines, it simply uses up whitespace un necessarily. I noticed that the first sub has been doubled up, is that a typo?

zx10
10-03-2023, 12:59 PM
Welcome to VBAX zx10. When posting code to the forum please wrap your code with code tags. See the first line in my signature as a hint. Secondly, there is no need to double space between your lines, it simply uses up whitespace un necessarily. I noticed that the first sub has been doubled up, is that a typo?
Ok, and the first sub is mailItem_Reply and the second is mailItem_ReplyAll

Anyone here do any outlook 365 vba?