RIYADBANK50
New Member
- Joined
- Dec 22, 2022
- Messages
- 3
- Office Version
- 2021
- Platform
- Windows
- Web
dear all
i have files excel i want to send email to multiple recipients .
because i have more than persons to put them in TO & CC .
if there is way to put all columns below in each email will be great .
wait your kindly replay and support as usual .
regards
i have files excel i want to send email to multiple recipients .
because i have more than persons to put them in TO & CC .
if there is way to put all columns below in each email will be great .
wait your kindly replay and support as usual .
regards
VBA Code:
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
With msg
.HTMLBody = GetHTMLBody(Name, "document", phone, documentName, inq)
End With
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
Send Multiple Mails2.xlsm | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | G | H | I | J | K | L | M | N | ||||
1 | To | CC | CC | Subject | Body | Status | CIC | NAME | DUE_DATE | PRODUCT_TYPE | AMOUNT | TICKET | ||||
2 | Bader T. Al Rujaib | Bader T. Al Rujaib | Omar M. Al-Mabouth | URGENT /// Rollover or settlement | "Dears, Kindly note that you have maturity as shown below, so please provide us with your respond to rollover the loan or settlement. And fill the data schedule below when you want to rollover it Regards" | 4117 | DHL | 20221025 | Murabaha Pure Bai Ajel | 8,321,411.10 | T0082101280 | |||||
3 | Bader T. Al Rujaib | Bader T. Al Rujaib | Omar M. Al-Mabouth | TEST -2 | "Dears, Kindly note that you have maturity as shown below, so please provide us with your respond to rollover the loan or settlement. And fill the data schedule below when you want to rollover it Regards" | 5222222 | SALMON | 20221025 | Murabaha Pure Bai Ajel | 8,321,411.10 | T0082101280 | |||||
4 | ||||||||||||||||
5 | ||||||||||||||||
6 | ||||||||||||||||
7 | ||||||||||||||||
Send_Mails |
Last edited by a moderator: