Solved

VBA - Outlook send to additional recipient

Posted on 2011-03-09
3
855 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 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:Murray Brown
ID: 35087887
Thanks very much
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
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…
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 …

717 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