6

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
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
nfnf
  • 127
  • 2
  • 2
  • 7

1 Answers1

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

or

oMail.CC = "email address here"
Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • Thank you very much. Very helpful. I appreicate your time. – nfnf Mar 06 '15 at 19:24
  • Please mark the post as answer if it answers your question. Thank you. – Dmitry Streblechenko Mar 07 '15 at 18:49
  • I would vote up but I just started and don't have quite enough rep points yet. – nfnf Mar 07 '15 at 19:07
  • In case you need to refer to the values directly, https://msdn.microsoft.com/en-us/VBA/Outlook-VBA/articles/enumerations-outlook and specifically for recipients the [OlMailRecipientType Enumeration](https://msdn.microsoft.com/en-us/vba/outlook-vba/articles/olmailrecipienttype-enumeration-outlook). – rburte May 08 '18 at 21:45