I am trying to remove a specific email address from the replyall using VBA macro. The following is my code
Public Sub Response(Item As Outlook.MailItem)
'Create an object to contain the original email
Dim origEmail As Outlook.MailItem
'Retain the original email
Set origEmail = Item
'Reply to everyone
Set myResponse = origEmail.ReplyAll
With myResponse
'Remove the sender from the array of recipients
.Recipients.Remove (1)
'Remove specific email address
For i = .Recipients.Count To 1 Step -1
If LCase(.Recipients.Item(i).Address) = "junior@yahoo.com" Then
.Recipients.Remove i
End If
Next
'Add the the messsage
'Attach the original e-mail
.Attachments.Add origEmail
'Send the message
.Send
End With
'Reset everything
Set myResponse = Nothing
Set origEmail = Nothing
End Sub
Any help would be appreciated why it doesn't remove the specific email address.
Bookmarks