Solved

VBA - Outlook send to additional recipient

Posted on 2011-03-09
3
828 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:murbro
  • 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 500 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:murbro
ID: 35087887
Thanks very much
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

808 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