如何插入代码以在现有代码上添加电子邮件地址

时间:2016-08-10 02:45:36

标签: vba outlook outlook-vba

我是这个编码世界的新手,我有以下工作代码,我想添加CC提交预先存在的电子邮件ID。

尝试各种方法,但无法破解代码

php app/console cache:clear

2 个答案:

答案 0 :(得分:1)

这与你为自己的身体做的一样。

Sub Reply_Scripting()
Dim origEmail As MailItem

Dim replyEmail As MailItem

Dim oRespond As Outlook.MailItem

Set origEmail = Application.ActiveWindow.Selection.Item(1)

Set replyEmail = Application.CreateItemFromTemplate("C:\Users\ashu\Desktop\test.oft")

'/ Add new CC addresses along with existing addresses.
replyEmail.CC = origEmail.CC & ";" & "a@b.com;c@d.com"


replyEmail.BodyFormat = olFormatHTML
replyEmail.HTMLBody = replyEmail.HTMLBody & origEmail.Reply.HTMLBody

replyEmail.Display

End Sub

答案 1 :(得分:1)

只需添加

replyEmail.CC = "Om3r@email.com"

示例

Sub Reply_Scripting()
    Dim origEmail As MailItem
    Dim replyEmail As MailItem
    Dim oRespond As Outlook.MailItem

    Set origEmail = Application.ActiveWindow.Selection.Item(1)
    Set replyEmail = Application.CreateItemFromTemplate("C:\Users\Test.oft")

    replyEmail.CC = "Om3r@email.com"

    replyEmail.HTMLBody = replyEmail.HTMLBody & origEmail.reply.HTMLBody
    replyEmail.display

End Sub