Outlook VBA发送电子邮件并全部回复

Option Explicit
Sub TestReply()
    Dim objApp As Application
    Dim objNewMail As Outlook.MailItem
    Dim objReply As Outlook.MailItem

    Set objApp = Outlook.Application
    Set objNewMail = objApp.CreateItem(0)

    ' Outgoing email
    With objNewMail
         .Subject = "Test sending email"
         .To = "letuanhai@live.com"
         .HTMLBody = "This is the outgoing email."
         .Send
    End With

    ' Reply email
    Set objReply = objNewMail.ReplyAll
    With objReply
        .HTMLBody = "This is the reply emal."
        .Display
    End With

    Set objApp = Nothing
    Set objNewMail = Nothing
    Set objReply = Nothing
End Sub

My task is to send an email containing a report and send another email containing another report to the same email thread by way of replying/forwarding to the sent email (excluding some recipients). The problem now is I can't seem to find a way to send the follow up email (either by reply or forward). When I try the above code, it says error the item is moved/deleted. I guess it is becaused when the email is sent, the objNewMail odject is also terminated.

一个相当幼稚的想法,但我也尝试将RE:或FW:添加到原始电子邮件的主题,但是这2封电子邮件将不在同一线程中,而是独立的电子邮件。

评论