Outlook 回复或回复所有电子邮件 [英] Outlook Reply or ReplyAll to an Email
问题描述
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)
objMail.To = "example@email.com"
objMail.cc = "example2@email.com"
objMail.Subject = "Mail test"
objMail.HTMLBody = "This is my message"
unload me
objMail.Display
Set objMail = Nothing
Set objOutlook = Nothing
我正在尝试添加另一个有助于回复选定电子邮件的功能,但不知道如何将其与 Item As Outlook.MailItem
混合使用我知道回复电子邮件需要这样做.
I am trying to add in another function that help to reply a selected email but can't figure out how I can mix this with Item As Outlook.MailItem
I understand that replying an email will require that.
所以我想知道如何添加以便我可以选择电子邮件,执行宏并将收件人电子邮件输入 objMail.To
并将收件人的正文输入 objMail.HTMLBody
So I would like to know how I can add on so that I can select an email, execute the macro and it will input the recipient email into objMail.To
and recipient's body into objMail.HTMLBody
推荐答案
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
这篇关于Outlook 回复或回复所有电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!