VBA to send email attachment to excel list of names

FireflyFL

New Member
Joined
Sep 18, 2018
Messages
3
Hello, I am trying to send an attachment to 60 people. I have the 60 names on a tab named Email List to be updated as needed. When adding names to the to field I obtained the error message "To many line continuations". Is it possible to correct the below to send to all 60 email addresses?



Sub EmailFile2()
Dim olApp As Object
Dim olMail As Object
Dim olSubject As String
Dim ToField As String


' // Turn off screen updating
Application.ScreenUpdating = False

Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)

olSubject = "I will be returning your requests if the instructions below aren't followed. " & Format(Date, "MMMM yyyy")

With olMail
.Display
End With
With olMail

.To = ThisWorkbook.Sheets("Email List").Range("B1") & _
ThisWorkbook.Sheets("Email List").Range("B2") & _
ThisWorkbook.Sheets("Email List").Range("B3") & _
ThisWorkbook.Sheets("Email List").Range("B4") & _
ThisWorkbook.Sheets("Email List").Range("B5") & _
ThisWorkbook.Sheets("Email List").Range("B6") & _
ThisWorkbook.Sheets("Email List").Range("B7") & _
ThisWorkbook.Sheets("Email List").Range("B8") & _
ThisWorkbook.Sheets("Email List").Range("B9") & _
ThisWorkbook.Sheets("Email List").Range("B10") & _
ThisWorkbook.Sheets("Email List").Range("B11") & _
ThisWorkbook.Sheets("Email List").Range("B12") & _
ThisWorkbook.Sheets("Email List").Range("B13") & _
ThisWorkbook.Sheets("Email List").Range("B14") & _
ThisWorkbook.Sheets("Email List").Range("B15") & _
ThisWorkbook.Sheets("Email List").Range("B16") & _
ThisWorkbook.Sheets("Email List").Range("B17") & _
ThisWorkbook.Sheets("Email List").Range("B18") & _
ThisWorkbook.Sheets("Email List").Range("B19") & _
ThisWorkbook.Sheets("Email List").Range("B20") & _
ThisWorkbook.Sheets("Email List").Range("B21") & _
ThisWorkbook.Sheets("Email List").Range("B22") & _
ThisWorkbook.Sheets("Email List").Range("B23") & _
ThisWorkbook.Sheets("Email List").Range("B24") & _
ThisWorkbook.Sheets("Email List").Range("B25")




.CC = ""
.BCC = ""
.Subject = olSubject
.HTMLBody = "
REMINDER:
"& .HTMLBody




.Attachments.Add "ATTACHLOCATION.XLS"
.Display
End With

' // Restore screen updating
Application.ScreenUpdating = True

Set olMail = Nothing
Set olApp = Nothing

End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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