Outloook VBA macro to reply all with oft template

与世无争的帅哥 提交于 2021-02-10 18:00:38

问题


I have a macro built for VBA Outlook where I can reply all, using an attachment. This is the code:

Sub Estimate()
    Dim origEmail As MailItem
    Dim replyEmail As MailItem
    Dim s() As String
    Dim add As String

    Set origEmail = Application.ActiveWindow.Selection.Item(1)
    Set replyEmail = Application.CreateItemFromTemplate("C:\template.oft")

    s = Split(origEmail.CC & ";" & replyEmail.CC, ";")

    replyEmail.HTMLBody = replyEmail.HTMLBody & origEmail.Reply.HTMLBody
    replyEmail.Subject = "RE: " + origEmail.Subject
    replyEmail.To = origEmail.Sender
    replyEmail.Display

End Sub

It's working ok except in cases where a person has more than a email linked to AD. In that case in the reply email I get the name of the person instead of the email. So the issue here is that it's copying the names from the original email and than its placing those names in the reply email. How can I change the code so that it copies the real email fro the original email and place them in the reply email?

来源:https://stackoverflow.com/questions/65899850/outloook-vba-macro-to-reply-all-with-oft-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!