添加 "CC recipient" 到 Outlook 2010 VBA
Add a "CC recipient" to Outlook 2010 VBA
有人可以告诉我如何向此代码添加 "Cc recipient" 吗? "To Recipient" 和代码都按预期工作。谢谢你的时间。
Sub ForwardEmail(item As Outlook.MailItem)
' Dim oExplorer As Outlook.Explorer
Dim oMail As MailItem
' Set oExplorer = Application.ActiveExplorer
On Error GoTo Release
' If oExplorer.Selection.item(1).Class = olMail Then
Set oMail = item.Forward
oMail.Subject = oMail.Subject
oMail.HTMLBody = "Have a nice day." & vbCrLf & oMail.HTMLBody
oMail.Recipients.Add "email address here"
' oMail.Save
oMail.Send
' End If
Release:
Set oMail = Nothing
' Set oExplorer = Nothing
End Sub
set oRecip = oMail.Recipients.Add("email address here")
oRecip.Type = olCC
或
oMail.CC = "email address here"
有人可以告诉我如何向此代码添加 "Cc recipient" 吗? "To Recipient" 和代码都按预期工作。谢谢你的时间。
Sub ForwardEmail(item As Outlook.MailItem)
' Dim oExplorer As Outlook.Explorer
Dim oMail As MailItem
' Set oExplorer = Application.ActiveExplorer
On Error GoTo Release
' If oExplorer.Selection.item(1).Class = olMail Then
Set oMail = item.Forward
oMail.Subject = oMail.Subject
oMail.HTMLBody = "Have a nice day." & vbCrLf & oMail.HTMLBody
oMail.Recipients.Add "email address here"
' oMail.Save
oMail.Send
' End If
Release:
Set oMail = Nothing
' Set oExplorer = Nothing
End Sub
set oRecip = oMail.Recipients.Add("email address here")
oRecip.Type = olCC
或
oMail.CC = "email address here"