1

我有一个宏,可以使用模板打开对选定电子邮件的回复。但是,电子邮件机器中的其余图像现在只显示一个红十字。

谁能明白为什么会发生这种情况?

    Sub TacReply()
Dim origEmail As MailItem
Dim replyEmail As MailItem
Set origEmail = Application.ActiveExplorer.Selection(1)
Set replyEmail = Application.CreateItemFromTemplate("S:\Share\TWGeneral.oft")
replyEmail.To = origEmail.SenderEmailAddress
replyEmail.Subject = origEmail.Subject
replyEmail.HTMLBody = replyEmail.HTMLBody & origEmail.Reply.HTMLBody
replyEmail.SentOnBehalfOfName = "email@address.com"
replyEmail.Display
End Sub

谢谢 :)

4

1 回答 1

1

以防万一有人遇到同样的问题,这是我使用的解决方案:

    Sub Forward_Mail_Outlook_With_Signature_Html_2()

    Dim MyItem As Object
    Dim MyFwdItem As MailItem

    Dim SigString As String
    Dim Signature As String

    Set MyItem = ActiveExplorer.Selection(1).reply

    If MyItem.Class = olMail Then

        Set MyFwdItem = MyItem.Forward

        'Change only Mysig.htm to the name of the signature

        SigString = Environ("appdata") & _
                "\Microsoft\Signatures\Your Signature.htm"

        If Dir(SigString) <> "" Then
            Signature = GetBoiler(SigString)
        Else
            Signature = ""
        End If

        With MyFwdItem
            .To = MyFwdItem.SenderEmailAddress
            .subject = MyFwdItem.subject
            .HTMLBody = "<br>" & Signature & .HTMLBody
            .SentOnBehalfOfName = "youremail@address.com"
            .Display


        End With
    Else

        MsgBox "Select a mailitem."

    End If

ExitRoutine:
    Set MyItem = Nothing
    Set MyFwdItem = Nothing

End Sub

Private Function GetBoiler(ByVal sFile As String) As String

    Dim fso As Object
    Dim ts As Object
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
    GetBoiler = ts.readall
    ts.Close

End Function
于 2016-07-15T13:08:37.813 回答