Consulting

Results 1 to 4 of 4

Thread: Solved: CC another person on an email

  1. #1
    VBAX Mentor
    Joined
    Aug 2011
    Posts
    353
    Location

    Solved: CC another person on an email

    How do I cc the email address mms_avalonserviceteam@ml.com in the below vba code?

    [VBA]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[/VBA]

  2. #2
    VBAX Mentor
    Joined
    Aug 2011
    Posts
    353
    Location
    I figured it out..

    [VBA]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[/VBA]

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You could also have used

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

    Set oRecipient = .Recipients.Add("mms_avalonserviceteam@ml.com")
    oRecipient.Type = 2[/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    VBAX Mentor
    Joined
    Aug 2011
    Posts
    353
    Location
    Great, thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •