adding content from excel into e-mail body via VBA

ben moor

New Member
Joined
Jan 19, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Good day
I'd need to send a number of e-mails containing information on an Excel file (one e-mail per row to different recipients). The code below works up to the point where I want the value in the range C1:C3 to be included in the e-mail body (I almost certain the bold part is where the error lies but I can't figure out what exactly is wrong).
Any help is highly appreciated.
Thank you

Sub test()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range


Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")

For Each cell In Worksheets("Sheet3").Range("A1:A3").Cells
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = Cells(cell.Row, "A").Value
.CC = "test@testing.com"
.Subject = "project"
.Body = "Good day" & vbCrLf & "Kindly update the client tool for the local entity " & Worksheets("Sheet3").Range("C1:C3").Value & vbCrLf & "Thank you and best regards"
.display
End With
Set OutMail = Nothing
Next cell


End Sub
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Try replacing . . .

VBA Code:
Worksheets("Sheet3").Range("C1:C3").Value

with

VBA Code:
cell.Offset(, 2).Value

Hope this helps!
 
Upvote 0
Solution

Forum statistics

Threads
1,215,056
Messages
6,122,907
Members
449,096
Latest member
dbomb1414

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