尝试在Outlook 2010中创建一个按钮,用于回复突出显示的电子邮件/打开的电子邮件,其中包含静态文本和cc的电子邮件地址

时间:2016-08-22 17:03:14

标签: vba email outlook outlook-vba outlook-2010

除了将电子邮件地址添加到cc之外,一切似乎都有效。 我正在测试的帐户可能会被GAL隐藏。

还有一种方法可以将用户的显示名称添加到正文中,即Great Job(动态名称即Ted,即我正在回复的电子邮件发送)!我喜欢你的工作。 。

使用Windows 7企业w / outlook 2010 professional Plus 32bit和exchange 2010。

谢谢!代码

Sub GoodJob()

Dim m As MailItem 'object/mail item iterator
Dim recip As Recipient 'object to represent recipient(s)
Dim reply As MailItem 'object which will represent the reply email

'Loop over each SELECTED item:
For Each m In Application.ActiveExplorer.Selection
If m.Class = olMail Then
Set reply = m.reply

'Adds a "direct replies to" address:
'Set recip = reply.ReplyRecipients.Add("g@g.com")
Set recip = reply.ReplyRecipients.Add("someperson@a.net")
recip.Type = olCC

'adds Subject "Great Job! I loved your work on this Project" to email
 reply.Subject = "Great Job ! I loved your work on this Project"

'Adds Body of text to email
reply.Body = "Your awesomeness has been shared with Driver X" & vbLf &   m.Body



reply.Save 'saves a draft copy to your SENT folder
reply.Send

End If
Next

End Sub

1 个答案:

答案 0 :(得分:0)

在这种情况下,不是ReplyRecipients只是收件人。

Set recip = reply.Recipients.Add("someperson@a.net")