Outlook Reply or ReplyAll to an Email

后端 未结 1 491
情歌与酒
情歌与酒 2020-11-28 14:22
Set objOutlook = CreateObject(\"Outlook.Application\")
Set objMail = objOutlook.CreateItem(0)
objMail.To = \"example@email.com\"
objMail.cc = \"example2@email.com\"
         


        
相关标签:
1条回答
  • 2020-11-28 14:37

    To simply Reply or ReplyAll selected messages try the following.

    Option Explicit
    Sub ReplyMSG()
        Dim olItem As Outlook.MailItem
        Dim olReply As MailItem ' Reply
        Dim olRecip As Recipient ' Add Recipient
    
        For Each olItem In Application.ActiveExplorer.Selection
        Set olReply = olItem.ReplyAll
        Set olRecip = olReply.Recipients.Add("Email Address Here") ' Recipient Address
            olRecip.Type = olCC
                olReply.HTMLBody = "Hello, Thank you. " & vbCrLf & olReply.HTMLBody
            olReply.Display
    
            'olReply.Send
        Next olItem
    End Sub
    

    To hide the recipient use BCC Example

    olRecip.Type = olBcc

    To add multiple recipient just add

    Set olRecip = olReply.Recipients.Add("Email Here")
    Set olRecip = olReply.Recipients.Add("Email Here")
    Set olRecip = olReply.Recipients.Add("Email Here")
    

    With out Recipient try the following.

    Option Explicit
    Sub ReplyMSG()
        Dim olItem As Outlook.MailItem
        Dim olReply As MailItem ' Reply
    
        For Each olItem In Application.ActiveExplorer.Selection
        Set olReply = olItem.ReplyAll
                olReply.HTMLBody = "Hello, Thank you. " & vbCrLf & olReply.HTMLBody
            olReply.Display
    
            'olReply.Send
        Next olItem
    End Sub
    
    0 讨论(0)
提交回复
热议问题