Send Email from VBA to Multiple Emails

weaselmcguff

Board Regular
Joined
Feb 24, 2006
Messages
246
I am trying to send an email to multiple people via VBA.
2 emails are standard and they will be in the .CC line.

an additonal email is from a selection the user makes pertaining to Zone. And the 4th email is from the auditor. These last 2 I have created the lookup and they work fine.

I cant seem to get this to work to send to multiple people on 1 line. Here is my code any help is greatly appreciated

Thanks

Private Sub CommandButton72_Click()
Dim date2 As String ' Date field
Dim email2 As String ' Who Email is Going To
Dim N1 As String ' Name Field
Dim subject1 As String ' What the email is about
Dim ccemail As String 'Inspectors email
Sheets("Teams").Select ' targets Office worksheet
ccemail = WorksheetFunction.VLookup(cbauditor2, Range("B31:D34"), 3, 0) 'returns email address
date2 = Worksheets("Office").Range("B3").Value ' Date
Worksheets("Office").Range("B2").Value = cbozone 'zone
Sheets("Teams").Select ' targets Office worksheet
email2 = WorksheetFunction.VLookup(cbozone, Range("A5:D28"), 4, 0) 'returns email address
With OutMail
If email2 = "" Then
email2 = Application.InputBox("Please enter Email To Automatically Email this To:")
Worksheets("Office").Range("E4").Value = email2
Else
'.To = email2 ' who email is going to
.CC = Array(ccemail, "joe.king@email.com") ' facilatator
.Subject = subject1 ' What the Email is about
.Attachments.Add ActiveWorkbook.FullName
.Body = ActiveSheet.Value
.Send
End If
End With
End Sub

Any suggestions are greatly appreciated

Thanks for your time
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I'm not sure I follow what you are asking...

Code:
Private Sub CommandButton72_Click()

    Dim date2  As String    ' Date field
    Dim email2 As String    ' Who Email is Going To
    Dim N1     As String    ' Name Field
    Dim subject1 As String  ' What the email is about
    Dim ccemail As String   ' Inspectors email
    [COLOR="Red"]Dim email3 As String    ' Prompted Email[/COLOR]
    
    Sheets("Teams").Select    ' targets Office worksheet
    ccemail = WorksheetFunction.VLookup(cbauditor2, Range("B31:D34"), 3, 0)    'returns email address
    date2 = Worksheets("Office").Range("B3").Value    ' Date
    Worksheets("Office").Range("B2").Value = cbozone    'zone
    Sheets("Teams").Select    ' targets Office worksheet
    email2 = WorksheetFunction.VLookup(cbozone, Range("A5:D28"), 4, 0)    'returns email address
    
    [COLOR="Red"]email3[/COLOR] = Application.InputBox("Please enter Email To Automatically Email this To:")
    Worksheets("Office").Range("E4").Value = [COLOR="Red"]email3[/COLOR]
        
    With OutMail
        .To = [COLOR="Red"]Array(email2, email3)[/COLOR] ' who email is going to
        .CC = Array(ccemail, "joe.king@email.com")    ' facilatator
        .Subject = subject1    ' What the Email is about
        .Attachments.Add ActiveWorkbook.FullName
        .Body = ActiveSheet.Value
        .Send
    End With
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,569
Messages
6,179,605
Members
452,928
Latest member
VinceG

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top