Outlook.Recipients.ResolveAll Failure Resolution

时间:2018-01-24 16:07:18

标签: outlook outlook-vba outlook-2010

当解析all无法处理时(由于我们系统上的多个用户具有相同的名/姓),宏无法运行。有没有办法让outlook显示名称,让我选择我想要的john doe(如果没有那么可能只是删除它无法解析的名字)。

    Sub Reply_All_From_Folder()

    Dim original As MailItem

    Dim reply As MailItem

    Set original = ActiveInspector.CurrentItem.ReplyAll

    Set reply = Application.CreateItem(olMailItem)

    With reply

        .SentOnBehalfOfName = "folder@work.com"

        .Subject = original.Subject

        .To = Replace(original.To, "emailoRemove@test.com", "")

        .CC = original.CC

        .HTMLBody = original.HTMLBody

        .Recipients.ResolveAll

        .Display

    End With

End Sub

2 个答案:

答案 0 :(得分:0)

不,Outlook不显示模糊的名称解析对话框。

如果使用Redemption是一个选项,则其版本RDOMailRecipientsResolveAll允许传递一个标记,以便您在必要时显示地址簿UI。

答案 1 :(得分:0)

如果ResolveAll为false,您可以模拟按Check Names按钮。

Sub Reply_All_From_Folder_NotResolveAll()

    Dim trueoriginal As mailItem
    Dim original As mailItem
    Dim reply As mailItem

    Set trueoriginal = ActiveInspector.currentItem
    Set original = ActiveInspector.currentItem.ReplyAll
    Set reply = CreateItem(olMailItem)

    With reply

        .subject = original.subject
        .To = original.To & "; notaresolvablename" & "; smith, john"

        If Not .Recipients.ResolveAll Then
            .Display
            ActiveInspector.CommandBars.ExecuteMso ("CheckNames")
        Else
            .Send
        End If

    End With

trueoriginal.Close olDiscard

ExitRoutine:
    Set trueoriginal = Nothing
    Set original = Nothing
    Set reply = Nothing

End Sub