Solved

VBA - Outlook send to additional recipient

Posted on 2011-03-09
3
798 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Access Running Very Slowly on Windows 7 PC 27 54
Run-time 91 error, not sure why 3 23
Max per month 3 14
Access on thin client? 11 28
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now