我正在尝试回复群组的Outlook公用文件夹中的所有内容,但会从回复地址中删除公用文件夹电子邮件地址。
到目前为止,我的代码是:
Sub Reply_All_From_Folder()
Dim original As MailItem
Dim reply As MailItem
Set original = ActiveInspector.CurrentItem.ReplyAll
Set reply = Application.CreateItem(olMailItem)
With reply
.SentOnBehalfOfName = "folder@work.com"
.Subject = original.Subject
.To = original.To
.CC = original.CC
.HTMLBody = original.HTMLBody
.Recipients.ResolveAll
.Display
End With
End Sub
答案 0 :(得分:1)
To和CC字段是以分号分隔的字符串列表。要删除地址,您需要将其替换为空字符串""
替换你的
.To = original.To
与
.To = Replace(original.To, "emailoRemove@test.com", "")
MSDN链接:https://msdn.microsoft.com/en-us/vba/outlook-vba/articles/mailitem-to-property-outlook