VBA: Automatically send emails in a loop with different attachments

NeoSez

Board Regular
Joined
Aug 14, 2020
Messages
242
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I am trying to figure out the best way to send bunch of emails to different recipients along with a different attachment for each person.
So, currently, I have this below. How do I modify the attachment script to choose from the same line as the contacts list?

VBA Code:
.Display
.To = toemail
.CC = ccemail
.subject = subject
.HTMLBody = body & .HTMLBody
.Attachments.Add tempFilename

ContactList IDEmail addressCC EmailAttachment
Pablo Lobster2pablo@hunger.comme@menu.comrecipe.pdf
Elvira Crabs3elvira@cooks.comPol@pots.comcrabs.pdf
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Good to hear you got the solution.
If you would like to post the solution then it is perfectly fine to mark your post as the solution to help future readers. Otherwise, please do not mark a post that doesn't contain a solution.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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