用于从答复所有VBA-OUTLOOK中删除特定收件人的宏

时间:2019-05-31 06:11:22

标签: vba outlook-vba

正如标题所述-我希望我的宏从收件人中删除我们的共享收件箱。当我收到该收件箱的电子邮件时,宏会执行“全部答复”按钮,它也会始终回复此共享的收件箱,从而造成混乱。不幸的是,负责删除电子邮件的代码部分根本无法工作

下方包含的代码

Sub MSGREPLY()

Dim mail
Dim replyall
Dim recip As Recipient

For Each mail In Outlook.Application.ActiveExplorer.Selection
    If mail.Class = olMail Then
        Set replyall = mail.replyall

        For Each recip In replyall.Recipients
                If (recip.Address) = "EmailAddressHere" Then
                    recip.Delete
                        Exit For
                            End If
                                Next

        With replyall
            .Body = "Message" & vbCrLf & .Body
            .Display
            .Send
        End With
    End If
Next

End Sub

任何提示或可能的解决方案?

0 个答案:

没有答案