Send different emails to different email ID"s from Excel

Sumit Dey

New Member
Joined
Nov 1, 2019
Messages
17
Hi everyone,

I know how to send emails to several emails ID's at a time using VBA... But, I am looking to send different emails to each email ID/ID's at once. Like we do in a mail merge.

Currently I am using mail merge whereas, some sections of the email are fixed and are taken from an word file but, some other parts of the email had to be different and here we use the data from an excel file. We merge data from the word file and the excel file and send them all at once.

I would be thankful if someone can find an alternate way of doing the same using the Excel vba alone.

Thanks a lot in advance
 
Use a loop through a range of cells with the fullpath to the files or in this example selected files.

Code:
.Body = ""

AttachFileName = Application.GetOpenFilename("Files (*.**)," & _
"*.**", 1, "Select File", "Open", True)

For i = 1 To UBound(AttachFileName)
.Attachments.Add AttachFileName(i)
Next

.Display

End With

Thank you so much again. Shall I simply replace this code in place of the code I used?

One more thing I am using an excel sheet from where my macro would fetch data to send emails. The Excel sheet have fields columns like -To, CC, Body, Attachments,etc I simply add data in the respective rows and the macro fetch these data to send mails.
I would like one more help ... if possible is there any code wherein, I can also used formatting like fonts, color , font sizes etc.
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Yes. Between the .Body and .Display as shown.


There are a couple of ways to do the formatting both require using .HTMLBody instead of .Body, which sends an html formatted mail instead of a text formatted.
The function RangetoHTML from here:
https://www.rondebruin.nl/win/s1/outlook/bmail2.htm
will copy a range of cells to the body with the formatting from Excel intact.

The other method is to add html tags to the email code with inline style for the text you want to format.
The content of the sheet in this case need not be formatted as it would be done by Outlook interpreting the html

Have a look at the link.
If you have problems just come back (and post all your updated code).
 
Upvote 0

Forum statistics

Threads
1,223,891
Messages
6,175,229
Members
452,621
Latest member
Laura_PinksBTHFT

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