?
Solved

VBA - Outlook send to additional recipient

Posted on 2011-03-09
3
Medium Priority
?
875 Views
Last Modified: 2012-05-11
Hi

How do I upgrade the code below to add another recipient?
Set ObjOutlook = New Outlook.Application
    Set ObjOutlookMsg = ObjOutlook.CreateItem(olMailItem)
 
    With ObjOutlookMsg
       Set objOutlookRecip = .Recipients.Add("admin@macros-vba.com")
       objOutlookRecip.Type = olTo
       .Subject = "SUBJECT GOES HERE"
       Set objectlookAttach = .Attachments.Add(oPathAndFile)
    
       For Each objOutlookRecip In .Recipients
            If Not objOutlookRecip.Resolve Then
                 ObjOutlookMsg.Display
            End If
       Next
       .Display
       '~~> Uncomment the below to send the email
       '.Send
    End With

Open in new window

0
Comment
Question by:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 35087490
      Set objOutlookRecip = .Recipients.Add("admin@macros-vba.com")
       objOutlookRecip.Type = olTo
        Set objOutlookRecip = .Recipients.Add("admin2@macros-vba.com")
       objOutlookRecip.Type = olTo
       Set objOutlookRecip = .Recipients.Add("admin3@macros-vba.com")
       objOutlookRecip.Type = olcc
       Set objOutlookRecip = .Recipients.Add("admin4@macros-vba.com")
       objOutlookRecip.Type = olbcc
 
Chris
 
0
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 2000 total points
ID: 35087650
i.e.

Chris
Set ObjOutlook = New Outlook.Application
    Set ObjOutlookMsg = ObjOutlook.CreateItem(olMailItem)
 
    With ObjOutlookMsg
       Set objOutlookRecip = .Recipients.Add("admin@macros-vba.com")
       objOutlookRecip.Type = olTo
       Set objOutlookRecip = .Recipients.Add("admin2@macros-vba.com")
       objOutlookRecip.Type = olTo
       Set objOutlookRecip = .Recipients.Add("admin3@macros-vba.com")
       objOutlookRecip.Type = olcc
       Set objOutlookRecip = .Recipients.Add("admin4@macros-vba.com")
       objOutlookRecip.Type = olbcc
       .Subject = "SUBJECT GOES HERE"
       Set objectlookAttach = .Attachments.Add(oPathAndFile)
    
       For Each objOutlookRecip In .Recipients
            If Not objOutlookRecip.Resolve Then
                 ObjOutlookMsg.Display
            End If
       Next
       .Display
       '~~> Uncomment the below to send the email
       '.Send
    End With

Open in new window

0
 

Author Closing Comment

by:Murray Brown
ID: 35087887
Thanks very much
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question