AmirFirdaus9509
New Member
- Joined
- Feb 14, 2022
- Messages
- 19
- Office Version
- 2016
- Platform
- Windows
Hi All ,
I would like to request an advice how to send multiple group email based on a cell content. Currently i have a table that contain , name , country , email , cc , subject.
The current existing macro that i have is able to send an email individually within the table.
I am testing out and currently at a dead end on how to send an email by group based on a cell country. In context , if there was 10 row of data and contain country such as US , UK and JP. There would be 3 different email generate within it . Here is an example of image for more clarity.
Sample of Table
Sample Email generated once run.
Here is my code that i am working on as reference.
Thank you very much for any assistance
I would like to request an advice how to send multiple group email based on a cell content. Currently i have a table that contain , name , country , email , cc , subject.
The current existing macro that i have is able to send an email individually within the table.
I am testing out and currently at a dead end on how to send an email by group based on a cell country. In context , if there was 10 row of data and contain country such as US , UK and JP. There would be 3 different email generate within it . Here is an example of image for more clarity.
Sample of Table
Sample Email generated once run.
Here is my code that i am working on as reference.
VBA Code:
Sub send_mass_email()
Dim i As Integer, cel As Range
Dim name As String, email As String, body As String, subject As String, copy As String, place As String, business As String
Dim OutApp As Object, OutMail As Object
body = ActiveSheet.TextBoxes("TextBox 1").Text
Set OutApp = CreateObject("Outlook.Application")
For Each cel In Range("A2", Range("A" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeVisible)
name = Split(cel, " ")(0) 'extract first name
email = cel.Offset(, 1).Value
subject = cel.Offset(, 2).Value
copy = cel.Offset(, 3).Value
Company = cel.Offset(, 4).Value
Origin = cel.Offset(, 5).Value
Paragraph = cel.Offset(, 7).Value
'replace place holders
body = Replace(body, "C1", name)
body = Replace(body, "C5", Company)
body = Replace(body, "C6", Origin)
body = Replace(body, "C7", Paragraph)
Set OutMail = OutApp.CreateItem(0)
With OutMail
.to = email
.CC = copy
.subject = subject
.body = body
'.HTMLBody = RangetoHTML("Q2:T3")
'.Attachments.Add ("") 'You can add files here
.display
'.Send
End With
Next cel
MsgBox "Email(s) Created!"
End Sub
Thank you very much for any assistance