回复全部带附件

Reply all with attachment

我有这个代码到 vba outlook 宏来回复所有人。

Sub my_test()

Dim objItem As Object

Dim mail As MailItem
Dim replyall As MailItem

Dim templateItem As MailItem

For Each objItem In ActiveExplorer.Selection

    If objItem.Class = olMail Then
    
        Set mail = objItem
        Set replyall = mail.replyall
                
        Set templateItem = CreateItemFromTemplate("C:\template.oft")
        
        With replyall
            .HTMLBody = templateItem.HTMLBody & .HTMLBody
            .Display
        End With
        
    End If
    
Next

End Sub

我正在尝试添加一项功能,以便当原始电子邮件带有附件(docx、pdf)时,当我使用此宏回复所有人时,它也会使用原始附件并将其作为附件放在回复中所有电子邮件。 我怎样才能做到这一点?

转发然后用 ReplyAll 中出现的内容填充 .To

Option Explicit

Sub my_test()

Dim objItem As Object

Dim mail As MailItem
Dim forwardMail As MailItem

Dim templateItem As MailItem

For Each objItem In ActiveExplorer.Selection

    If objItem.Class = olMail Then
    
        Set mail = objItem
        Set forwardMail = mail.Forward
        
        Set templateItem = CreateItemFromTemplate("C:\template.oft")
        
        With forwardMail
            .HTMLBody = templateItem.HTMLBody & .HTMLBody
            .To = mail.replyall.To
            .Display
        End With
        
    End If
    
Next

End Sub