BULK MAIL FROM EXCEL

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Good Afternoon guys.
I need a help regarding to send the mails with attachment by excel to multiple recipient.
like
TOCCBCCSUBJECTBODYATTACHMENT
test1@mail.com, test2@mail.comcc1@mail.com, cc2@mail.combcc@mail.comtest mailhic:\users\desktop\abc.xlsx

i am not well versed about the macros, i am in need to send bulk mails with attachment. Please help me out.
i have this code, but its not working if i am putting mail id in cell by separating through comma

Option Explicit

Sub Send_Mails()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Send_Mails")
Dim i As Integer

Dim OA As Object
Dim msg As Object

Set OA = CreateObject("outlook.application")

Dim last_row As Integer
last_row = Application.CountA(sh.Range("A:A"))

For i = 2 To last_row
Set msg = OA.createitem(0)
msg.to = sh.Range("A" & i).Value
msg.cc = sh.Range("B" & i).Value
msg.Subject = sh.Range("C" & i).Value
msg.body = sh.Range("D" & i).Value

If sh.Range("E" & i).Value <> "" Then
msg.attachments.Add sh.Range("E" & i).Value
End If

msg.send

sh.Range("F" & i).Value = "Sent"

Next i

MsgBox "All the mails have been sent successfully"


End Sub
 
Upvote 0
if you replace "msg.send" by "msg.display" then do you get those emails on your screen or don't you even get there ?
 
Upvote 0
emails have to be separated by semicolon not a comma, so try:

VBA Code:
msg.to = replace(sh.Range("A" & i).Value,",",";")
msg.cc = replace(sh.Range("B" & i).Value,",",";")
 
Upvote 0
Solution
if you replace "msg.send" by "msg.display" then do you get those emails on your screen or don't you even get there ?
yeh its working,
but its opening multiple window of outlook, where i have to click one by one on send button.
It will be ok for less recipient, but if i will send it to 5oo recipient then ?
 
Upvote 0
emails have to be separated by semicolon not a comma, so try:

VBA Code:
msg.to = replace(sh.Range("A" & i).Value,",",";")
msg.cc = replace(sh.Range("B" & i).Value,",",";")
Thanks sir,
Now it is working.

thank you so much.
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,361
Members
449,080
Latest member
Armadillos

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