How to send email to multiple recipients with addresses stored in Excel? How to send email to multiple recipients with addresses stored in Excel? vba vba

How to send email to multiple recipients with addresses stored in Excel?


You have to loop through every cell in the range "D3:D6" and construct your To string. Simply assigning it to a variant will not solve the purpose. EmailTo becomes an array if you assign the range directly to it. You can do this as well but then you will have to loop through the array to create your To string

Is this what you are trying? (TRIED AND TESTED)

Option ExplicitSub Mail_workbook_Outlook_1()     'Working in 2000-2010     'This example send the last saved version of the Activeworkbook    Dim OutApp As Object    Dim OutMail As Object    Dim emailRng As Range, cl As Range    Dim sTo As String    Set emailRng = Worksheets("Selections").Range("D3:D6")    For Each cl In emailRng         sTo = sTo & ";" & cl.Value    Next    sTo = Mid(sTo, 2)    Set OutApp = CreateObject("Outlook.Application")    Set OutMail = OutApp.CreateItem(0)    On Error Resume Next    With OutMail        .To = sTo        .CC = "person1@email.com;person2@email.com"        .BCC = ""        .Subject = "RMA #" & Worksheets("RMA").Range("E1")        .Body = "Attached to this email is RMA #" & _        Worksheets("RMA").Range("E1") & _        ". Please follow the instructions for your department included in this form."        .Attachments.Add ActiveWorkbook.FullName         'You can add other files also like this         '.Attachments.Add ("C:\test.txt")        .Display    End With    On Error GoTo 0    Set OutMail = Nothing    Set OutApp = NothingEnd Sub


ToAddress = "test@test.com"ToAddress1 = "test1@test.com"ToAddress2 = "test@test.com"MessageSubject = "It works!."Set ol = CreateObject("Outlook.Application")Set newMail = ol.CreateItem(olMailItem)newMail.Subject = MessageSubjectnewMail.RecipIents.Add(ToAddress)newMail.RecipIents.Add(ToAddress1)newMail.RecipIents.Add(ToAddress2)newMail.Send


Both answers are correct.If you user .TO -method then the semicolumn is OK - but not for the addrecipients-method. There you need to split, e.g. :

                Dim Splitter() As String                Splitter = Split(AddrMail, ";")                For Each Dest In Splitter                    .Recipients.Add (Trim(Dest))                Next