Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a "CC recipient" to Outlook 2010 VBA

Tags:

vba

outlook

Can someone please show me how to add a "Cc recipient" to this code? The "To Recipient" and code all work as intended. Thank you for your time.

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
like image 852
nfnf Avatar asked Mar 06 '15 17:03

nfnf


1 Answers

set oRecip = oMail.Recipients.Add("email address here")
oRecip.Type = olCC

or

oMail.CC = "email address here"
like image 177
Dmitry Streblechenko Avatar answered Oct 12 '22 06:10

Dmitry Streblechenko