Reply to All Warning

  • Thread starter Thread starter claudia914
  • Start date Start date
C

claudia914

I want a warning to display when the "Reply to All" is clicked.

I am adding the following code to "This Outlook Session":

Private Sub myItem_ReplyAll(ByVal Response As Object, Cancel As
Boolean)
Dim mymsg As String
Dim myResult As Integer
mymsg = "Do you really want to reply to all original recipients?"
myResult = MsgBox(mymsg, vbYesNo, "Flame Protector")
If myResult = vbNo Then
Cancel = True
End If
End Sub

However, it does not work. What am I missing?

Thanks for your help.
 
What you're missing is the fact that at any given moment, the user could reply to any open message or any selected message. The code to keep track of all those messages and handle the ReplyAll event for ***every one of them*** is quite complicated.

But it's not so hard to determine whether a message is a reply to all. See http://www.outlookcode.com/codedetail.aspx?id=1299 for a little VBA routine that uses the Inspectors.NewInspector event to prompt the user and then remove all but the first Recipient if the user doesn't want to Reply to All.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
I followed the instructions and used this code. However, if I click No
when prompted "do you want to reply to all", it still includes all
recipients in the message. I also get prompted even if I do a "reply"
and not "replyall".

Thanks.
 
Forgot to change one thing before I posted it. Change this statement:

If msg.Recipients.count > 0 Then

to

If msg.Recipients.count > 1 Then

Let me know if that works better. You could also use Recipient.Delete instead of Recipients.Remove but I felt lazy today (after watching about 8 inches of rain in 3 days).
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
The original recipients do not get removed when NO is clicked. Here's
the code:

If myResult = vbNo Then
' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
msg.Recipients.Remove i

Thanks.
 
If you want to remove all recipients, the For statement would need to count to 1, not 2. I wanted to leave the first recipient in for myself.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


butterfly said:
The original recipients do not get removed when NO is clicked. Here's
the code:

If myResult = vbNo Then
' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
msg.Recipients.Remove i

Thanks.

Forgot to change one thing before I posted it. Change this statement:

If msg.Recipients.count > 0 Then

to

If msg.Recipients.count > 1 Then

Let me know if that works better. You could also use Recipient.Delete instead of Recipients.Remove but I felt lazy today (after watching about 8 inches of rain in 3 days).
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


butterfly said:
I followed the instructions and used this code. However, if I click No
when prompted "do you want to reply to all", it still includes all
recipients in the message. I also get prompted even if I do a "reply"
and not "replyall".

Thanks.


Sue Mosher [MVP-Outlook] wrote:
What you're missing is the fact that at any given moment, the user could reply to any open message or any selected message. The code to keep track of all those messages and handle the ReplyAll event for ***every one of them*** is quite complicated.

But it's not so hard to determine whether a message is a reply to all. See http://www.outlookcode.com/codedetail.aspx?id=1299 for a little VBA routine that uses the Inspectors.NewInspector event to prompt the user and then remove all but the first Recipient if the user doesn't want to Reply to All.
I want a warning to display when the "Reply to All" is clicked.

I am adding the following code to "This Outlook Session":

Private Sub myItem_ReplyAll(ByVal Response As Object, Cancel As
Boolean)
Dim mymsg As String
Dim myResult As Integer
mymsg = "Do you really want to reply to all original recipients?"
myResult = MsgBox(mymsg, vbYesNo, "Flame Protector")
If myResult = vbNo Then
Cancel = True
End If
End Sub

However, it does not work. What am I missing?

Thanks for your help.
 
I would like to leave the first recipient as well. However, when you
click "NO" it does not remove any recipients so the behavior is the
same as clicking "YES".

Thanks.

If you want to remove all recipients, the For statement would need to count to 1, not 2. I wanted to leave the first recipient in for myself.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


butterfly said:
The original recipients do not get removed when NO is clicked. Here's
the code:

If myResult = vbNo Then
' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
msg.Recipients.Remove i

Thanks.

Forgot to change one thing before I posted it. Change this statement:

If msg.Recipients.count > 0 Then

to

If msg.Recipients.count > 1 Then

Let me know if that works better. You could also use Recipient.Delete instead of Recipients.Remove but I felt lazy today (after watching about 8 inches of rain in 3 days).
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


I followed the instructions and used this code. However, if I click No
when prompted "do you want to reply to all", it still includes all
recipients in the message. I also get prompted even if I do a "reply"
and not "replyall".

Thanks.


Sue Mosher [MVP-Outlook] wrote:
What you're missing is the fact that at any given moment, the user could reply to any open message or any selected message. The code to keep track of all those messages and handle the ReplyAll event for ***every one of them*** is quite complicated.

But it's not so hard to determine whether a message is a reply to all. See http://www.outlookcode.com/codedetail.aspx?id=1299 for a little VBA routine that uses the Inspectors.NewInspector event to prompt the user and then remove all but the first Recipient if the user doesn't want to Reply to All.


I want a warning to display when the "Reply to All" is clicked.

I am adding the following code to "This Outlook Session":

Private Sub myItem_ReplyAll(ByVal Response As Object, Cancel As
Boolean)
Dim mymsg As String
Dim myResult As Integer
mymsg = "Do you really want to reply to all original recipients?"
myResult = MsgBox(mymsg, vbYesNo, "Flame Protector")
If myResult = vbNo Then
Cancel = True
End If
End Sub

However, it does not work. What am I missing?

Thanks for your help.
 
That's weird. It works fine here. What version of Outlook are you using? If you comment out the On Error Resume Next statement, do you get any errors?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


butterfly said:
I would like to leave the first recipient as well. However, when you
click "NO" it does not remove any recipients so the behavior is the
same as clicking "YES".

Thanks.

If you want to remove all recipients, the For statement would need to count to 1, not 2. I wanted to leave the first recipient in for myself.
butterfly said:
The original recipients do not get removed when NO is clicked. Here's
the code:

If myResult = vbNo Then
' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
msg.Recipients.Remove i

Thanks.


Sue Mosher [MVP-Outlook] wrote:
Forgot to change one thing before I posted it. Change this statement:

If msg.Recipients.count > 0 Then

to

If msg.Recipients.count > 1 Then

Let me know if that works better. You could also use Recipient.Delete instead of Recipients.Remove but I felt lazy today (after watching about 8 inches of rain in 3 days).

I followed the instructions and used this code. However, if I click No
when prompted "do you want to reply to all", it still includes all
recipients in the message. I also get prompted even if I do a "reply"
and not "replyall".

Thanks.


Sue Mosher [MVP-Outlook] wrote:
What you're missing is the fact that at any given moment, the user could reply to any open message or any selected message. The code to keep track of all those messages and handle the ReplyAll event for ***every one of them*** is quite complicated.

But it's not so hard to determine whether a message is a reply to all. See http://www.outlookcode.com/codedetail.aspx?id=1299 for a little VBA routine that uses the Inspectors.NewInspector event to prompt the user and then remove all but the first Recipient if the user doesn't want to Reply to All.


I want a warning to display when the "Reply to All" is clicked.
 
I am using Outlook 2003. This is the error I get:

Run Time Error 438
Object doesn't support this property or method. The debugger takes me
to this statement: msg.Recipients.Remove i

The statements prior to that are:

If myResult = vbNo Then
' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
msg.Recipients.Remove i



Thanks.

That's weird. It works fine here. What version of Outlook are you using? If you comment out the On Error Resume Next statement, do you get any errors?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


butterfly said:
I would like to leave the first recipient as well. However, when you
click "NO" it does not remove any recipients so the behavior is the
same as clicking "YES".

Thanks.

If you want to remove all recipients, the For statement would need to count to 1, not 2. I wanted to leave the first recipient in for myself.
The original recipients do not get removed when NO is clicked. Here's
the code:

If myResult = vbNo Then
' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
msg.Recipients.Remove i

Thanks.


Sue Mosher [MVP-Outlook] wrote:
Forgot to change one thing before I posted it. Change this statement:

If msg.Recipients.count > 0 Then

to

If msg.Recipients.count > 1 Then

Let me know if that works better. You could also use Recipient.Delete instead of Recipients.Remove but I felt lazy today (after watching about 8 inches of rain in 3 days).

I followed the instructions and used this code. However, if I click No
when prompted "do you want to reply to all", it still includes all
recipients in the message. I also get prompted even if I do a "reply"
and not "replyall".

Thanks.


Sue Mosher [MVP-Outlook] wrote:
What you're missing is the fact that at any given moment, the user could reply to any open message or any selected message. The code to keep track of all those messages and handle the ReplyAll event for ***every one of them*** is quite complicated.

But it's not so hard to determine whether a message is a reply to all. See http://www.outlookcode.com/codedetail.aspx?id=1299 for a little VBA routine that uses the Inspectors.NewInspector event to prompt the user and then remove all but the first Recipient if the user doesn't want to Reply to All.


I want a warning to display when the "Reply to All" is clicked.
 
See if this logic works then:

' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
Set recip = msg.Recipients(i)
recip.Delete
next
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


butterfly said:
I am using Outlook 2003. This is the error I get:

Run Time Error 438
Object doesn't support this property or method. The debugger takes me
to this statement: msg.Recipients.Remove i

The statements prior to that are:

If myResult = vbNo Then
' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
msg.Recipients.Remove i



Thanks.

That's weird. It works fine here. What version of Outlook are you using? If you comment out the On Error Resume Next statement, do you get any errors?

butterfly said:
I would like to leave the first recipient as well. However, when you
click "NO" it does not remove any recipients so the behavior is the
same as clicking "YES".

Thanks.


Sue Mosher [MVP-Outlook] wrote:
If you want to remove all recipients, the For statement would need to count to 1, not 2. I wanted to leave the first recipient in for myself.

The original recipients do not get removed when NO is clicked. Here's
the code:

If myResult = vbNo Then
' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
msg.Recipients.Remove i

Thanks.


Sue Mosher [MVP-Outlook] wrote:
Forgot to change one thing before I posted it. Change this statement:

If msg.Recipients.count > 0 Then

to

If msg.Recipients.count > 1 Then

Let me know if that works better. You could also use Recipient.Delete instead of Recipients.Remove but I felt lazy today (after watching about 8 inches of rain in 3 days).
I followed the instructions and used this code. However, if I click No
when prompted "do you want to reply to all", it still includes all
recipients in the message. I also get prompted even if I do a "reply"
and not "replyall".

Thanks.


Sue Mosher [MVP-Outlook] wrote:
What you're missing is the fact that at any given moment, the user could reply to any open message or any selected message. The code to keep track of all those messages and handle the ReplyAll event for ***every one of them*** is quite complicated.

But it's not so hard to determine whether a message is a reply to all. See http://www.outlookcode.com/codedetail.aspx?id=1299 for a little VBA routine that uses the Inspectors.NewInspector event to prompt the user and then remove all but the first Recipient if the user doesn't want to Reply to All.


I want a warning to display when the "Reply to All" is clicked.
 
See if this logic works then:

' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
Set recip = msg.Recipients(i)
recip.Delete
next
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


butterfly said:
I am using Outlook 2003. This is the error I get:

Run Time Error 438
Object doesn't support this property or method. The debugger takes me
to this statement: msg.Recipients.Remove i

The statements prior to that are:

If myResult = vbNo Then
' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
msg.Recipients.Remove i



Thanks.

That's weird. It works fine here. What version of Outlook are you using? If you comment out the On Error Resume Next statement, do you get any errors?

butterfly said:
I would like to leave the first recipient as well. However, when you
click "NO" it does not remove any recipients so the behavior is the
same as clicking "YES".

Thanks.


Sue Mosher [MVP-Outlook] wrote:
If you want to remove all recipients, the For statement would need to count to 1, not 2. I wanted to leave the first recipient in for myself.

The original recipients do not get removed when NO is clicked. Here's
the code:

If myResult = vbNo Then
' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
msg.Recipients.Remove i

Thanks.


Sue Mosher [MVP-Outlook] wrote:
Forgot to change one thing before I posted it. Change this statement:

If msg.Recipients.count > 0 Then

to

If msg.Recipients.count > 1 Then

Let me know if that works better. You could also use Recipient.Delete instead of Recipients.Remove but I felt lazy today (after watching about 8 inches of rain in 3 days).
I followed the instructions and used this code. However, if I click No
when prompted "do you want to reply to all", it still includes all
recipients in the message. I also get prompted even if I do a "reply"
and not "replyall".

Thanks.


Sue Mosher [MVP-Outlook] wrote:
What you're missing is the fact that at any given moment, the user could reply to any open message or any selected message. The code to keep track of all those messages and handle the ReplyAll event for ***every one of them*** is quite complicated.

But it's not so hard to determine whether a message is a reply to all. See http://www.outlookcode.com/codedetail.aspx?id=1299 for a little VBA routine that uses the Inspectors.NewInspector event to prompt the user and then remove all but the first Recipient if the user doesn't want to Reply to All.


I want a warning to display when the "Reply to All" is clicked.
 
Sue,

This does not work. The recipients are still not removed.

I am using Outlook 2003. Thanks.

See if this logic works then:

' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
Set recip = msg.Recipients(i)
recip.Delete
next
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


butterfly said:
I am using Outlook 2003. This is the error I get:

Run Time Error 438
Object doesn't support this property or method. The debugger takes me
to this statement: msg.Recipients.Remove i

The statements prior to that are:

If myResult = vbNo Then
' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
msg.Recipients.Remove i



Thanks.

That's weird. It works fine here. What version of Outlook are you using? If you comment out the On Error Resume Next statement, do you get any errors?

I would like to leave the first recipient as well. However, when you
click "NO" it does not remove any recipients so the behavior is the
same as clicking "YES".

Thanks.


Sue Mosher [MVP-Outlook] wrote:
If you want to remove all recipients, the For statement would need to count to 1, not 2. I wanted to leave the first recipient in for myself.

The original recipients do not get removed when NO is clicked. Here's
the code:

If myResult = vbNo Then
' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
msg.Recipients.Remove i

Thanks.


Sue Mosher [MVP-Outlook] wrote:
Forgot to change one thing before I posted it. Change this statement:

If msg.Recipients.count > 0 Then

to

If msg.Recipients.count > 1 Then

Let me know if that works better. You could also use Recipient.Delete instead of Recipients.Remove but I felt lazy today (after watching about 8 inches of rain in 3 days).


I followed the instructions and used this code. However, if I click No
when prompted "do you want to reply to all", it still includes all
recipients in the message. I also get prompted even if I do a "reply"
and not "replyall".

Thanks.


Sue Mosher [MVP-Outlook] wrote:
What you're missing is the fact that at any given moment, the user could reply to any open message or any selected message. The code to keep track of all those messages and handle the ReplyAll event for ***every one of them*** is quite complicated.

But it's not so hard to determine whether a message is a reply to all. See http://www.outlookcode.com/codedetail.aspx?id=1299 for a little VBA routine that uses the Inspectors.NewInspector event to prompt the user and then remove all but the first Recipient if the user doesn't want to Reply to All.


I want a warning to display when the "Reply to All" is clicked.
 
Sorry, but I just can't reproduce the problem, so I can't fix it. :(

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


butterfly said:
Sue,

This does not work. The recipients are still not removed.

I am using Outlook 2003. Thanks.

See if this logic works then:

' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
Set recip = msg.Recipients(i)
recip.Delete
next
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


butterfly said:
I am using Outlook 2003. This is the error I get:

Run Time Error 438
Object doesn't support this property or method. The debugger takes me
to this statement: msg.Recipients.Remove i

The statements prior to that are:

If myResult = vbNo Then
' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
msg.Recipients.Remove i



Thanks.


Sue Mosher [MVP-Outlook] wrote:
That's weird. It works fine here. What version of Outlook are you using? If you comment out the On Error Resume Next statement, do you get any errors?
I would like to leave the first recipient as well. However, when you
click "NO" it does not remove any recipients so the behavior is the
same as clicking "YES".

Thanks.


Sue Mosher [MVP-Outlook] wrote:
If you want to remove all recipients, the For statement would need to count to 1, not 2. I wanted to leave the first recipient in for myself.

The original recipients do not get removed when NO is clicked. Here's
the code:

If myResult = vbNo Then
' remove all recipients except the first one
count = msg.Recipients.count
For i = count To 2 Step -1
msg.Recipients.Remove i

Thanks.


Sue Mosher [MVP-Outlook] wrote:
Forgot to change one thing before I posted it. Change this statement:

If msg.Recipients.count > 0 Then

to

If msg.Recipients.count > 1 Then

Let me know if that works better. You could also use Recipient.Delete instead of Recipients.Remove but I felt lazy today (after watching about 8 inches of rain in 3 days).


I followed the instructions and used this code. However, if I click No
when prompted "do you want to reply to all", it still includes all
recipients in the message. I also get prompted even if I do a "reply"
and not "replyall".

Thanks.


Sue Mosher [MVP-Outlook] wrote:
What you're missing is the fact that at any given moment, the user could reply to any open message or any selected message. The code to keep track of all those messages and handle the ReplyAll event for ***every one of them*** is quite complicated.

But it's not so hard to determine whether a message is a reply to all. See http://www.outlookcode.com/codedetail.aspx?id=1299 for a little VBA routine that uses the Inspectors.NewInspector event to prompt the user and then remove all but the first Recipient if the user doesn't want to Reply to All.


I want a warning to display when the "Reply to All" is clicked.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top