I want to send mail to each recipient (separate mail) in Col A, subject in Col B, and data from Col D to Col I in Excel as mail body.
I found the below code and the code is working fine for email address & subject.
In the body it is picking data from only one column (Col D). How to update the range D2:I2 in the body with formatting?
Option Explicit
Sub Sample()
Dim OutApp As Object, OutMail As Object
Dim ws As Worksheet
Dim i As Long, lRow As Long
Set OutApp = CreateObject("Outlook.Application")
Set ws = ThisWorkbook.Sheets("Sheet1")
With ws
lRow = .Range("A" & .Rows.Count).End(xlUp).Row
For i = 1 To lRow
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = ws.Range("B" & i).Value
.Cc = ""
.Subject = ws.Range("C" & i).Value
.Body = ws.Range("D" & i).Value
.Display
End With
Next i
End With
End Sub
Excel Sample Data