PDA

View Full Version : Solved: CC another person on an email



Klartigue
04-19-2012, 07:08 AM
How do I cc the email address mms_avalonserviceteam@ml.com in the below vba code?

Sub EmailMerrill()
Dim oOutlook As Object
Dim oMailItem As Object
Dim oRecipient As Object
Dim oNameSpace As Object
Dim Lastrow As Long
Dim bodyText As String
Dim i As Long


Set oOutlook = CreateObject("Outlook.Application")
Set oNameSpace = oOutlook.GetNameSpace("MAPI")
oNameSpace.Logon , , True


Set oMailItem = oOutlook.CreateItem(0)

With oMailItem

Set oRecipient = .Recipients.Add("mms_tradeallocationsteam@ml.com.com")
oRecipient.Type = 1

.Subject = "Avalon Trade Allocations Attached"

.body = "Please see the attached trade allocations." & vbNewLine & vbNewLine & _
"Let me know if you need anything else." & vbNewLine & vbNewLine & _
"Thanks, " & vbNewLine & vbNewLine & _
"Katherine Lartigue " & vbNewLine & _
"klartigue@avalonadvisors.com 713-238-2088"

.Attachments.Add ("G:\Katherine Lartigue\Allocations\Merrill Lynch Trades.xls")
.Save

End With

End Sub

Klartigue
04-19-2012, 07:23 AM
I figured it out..

Sub EmailMerrill()
Dim oOutlook As Object
Dim oMailItem As Object
Dim oRecipient As Object
Dim oNameSpace As Object
Dim Lastrow As Long
Dim bodyText As String
Dim i As Long


Set oOutlook = CreateObject("Outlook.Application")
Set oNameSpace = oOutlook.GetNameSpace("MAPI")
oNameSpace.Logon , , True


Set oMailItem = oOutlook.CreateItem(0)

With oMailItem

Set oRecipient = .Recipients.Add("mms_tradeallocationsteam@ml.com.com")
oRecipient.Type = 1

.CC = "mms_avalonserviceteam@ml.com"
.Subject = "Avalon Trade Allocations Attached"

.body = "Please see the attached trade allocations." & vbNewLine & vbNewLine & _
"Let me know if you need anything else." & vbNewLine & vbNewLine & _
"Thanks, " & vbNewLine & vbNewLine & _
"Katherine Lartigue " & vbNewLine & _
"klartigue@avalonadvisors.com 713-238-2088"

.Attachments.Add ("G:\Katherine Lartigue\Allocations\Merrill Lynch Trades.xls")
.Save

End With

End Sub

Bob Phillips
04-19-2012, 03:57 PM
You could also have used


Set oRecipient = .Recipients.Add("mms_tradeallocationsteam@ml.com.com")
oRecipient.Type = 1

Set oRecipient = .Recipients.Add("mms_avalonserviceteam@ml.com")
oRecipient.Type = 2

Klartigue
04-20-2012, 02:26 PM
Great, thanks!