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
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hi,

Your question is so vague ...it will be difficult for any contributor to provide a solution ...
 
Upvote 0
Sorry for any confusion I'll try to explain my question here...

I have an Excel where I have an commandbutton clicking which I send a particular (same) email to multiple receivers.

What I need here is that when I click the commandbutton I shall be able to send each receiver a different email and not a same email to everyone.

I hope I made myself clear here...
 
Upvote 0
The code I am using:

Sub SendEmails()

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
'Input email ids here and use ";" is case email need to send multiple users
.To = "test.test@test.com
.CC = "Email2@gmail.com"
.BCC = "Email3@gmail.com"
'Subject Line comes here
.Subject = "Email Subject Line"

'email body comes here use "vblf" for multi-line text
.Body = "Body Text Line 1" & _
vbLf & "Text Line 2" & _
vbLf & "Text Line 3"

'attachments here
.Attachments.Add ("C:FilePathAttachmentFile.txt")


.Display '.Send

End With
On Error GoTo 0

'Free up the memory
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
 
Upvote 0
Within your macro ... you are dealing by definition with variables ...

So ..do no understand what is preventing you from adapting the variables such as :

.To and .Body
 
Upvote 0
Hard-code the email as Mail1, Mail2 etc or use ranges where the text resides.

Use Select Case for the email address to determine which MailX is sent to said address.
 
Upvote 0
Yeah got it... Thanks a lot...
One more question could you help me with a code wherein I can attach multiple attachments not just a single
 
Upvote 0
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
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,187
Members
452,616
Latest member
intern444

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