从Excel宏中的Outlook中全部回复 [英] Reply All in Outlook from Excel Macro
问题描述
当您点击Outlook中的全部回复时,它将打开一个新的电子邮件箱,但显示您电子邮件正文之前的以前的电子邮件。我正在回覆所有选定的电子邮件的outlook和输入信息。我想从Excel中的一个宏完成这一切。我的问题是,如果我尝试写回复全部的正文,它将删除整个以前的电子邮件线程。
When you click reply all in outlook, it will open a new email box, but show the previous email thread underneath the body of your email. I am trying to Reply All to the selected email in outlook and input information. I want to do this all from a Macro in Excel. My problem is that if I try to write in the body of the Reply All, it erases the entire previous email thread.
Sub test()
Dim mail 'object/mail item iterator
Dim replyall 'object which will represent the reply email
For Each mail In Outlook.Application.ActiveExplorer.Selection
If mail.Class = olMail Then
Set replyall = mail.replyall
With replyall
'.Body = "blah blah hello world" '<-- uncomment and it will delete the thread
.Display
End With
End If
Next
End Sub
注意:我最近来的是这个,但它会从最新的电子邮件中删除我的签名,电子邮件分隔符和标题信息:
Note: the closest I've come is this, but it deletes my signature, the email separator, and the header info from the latest email:
.Body = "blah blah hello world" & mail.body
任何解决方案都非常感激!谢谢!
Any solutions are appreciated! Thanks!
推荐答案
对于纯文本,您可以执行
For the plain text, you can do
.Body = "blah blah hello world" & vbCrLf & .Body
如果要保留格式,您需要将字符串插入 replyall.HTMLBody
属性(你不能只是连接两个HTML字符串)。
If you want to preserve formatting, you will need to insert your string into the replyall.HTMLBody
property (you cannot just concatenate two HTML strings).
这篇关于从Excel宏中的Outlook中全部回复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!