VBA code to draft email from multiple cells

CT30

New Member
Joined
Feb 16, 2025
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I am looking for code that drafts the email using multiple cell values that are in different lines. TIA

Fromct@yahoo.com
To123@yahoo.com
CCabc@yahoo.com
Subject LineTest 123
ContentHello,
Below are the details of your order
Order Number: 123
Reference: 456
Thank you
 

Attachments

  • VBA code.PNG
    VBA code.PNG
    11.5 KB · Views: 4
This is what I have, but this picks body content only in cell B10, I also need to add cc field


Sub Test()
Dim OutObj As Object, OutMail As Object
Set OutObj = CreateObject("Outlook.Application")
Set OutMail = OutObj.CreateItem(0)
With OutMail
.To = Range("B6").Value
.Subject = Range("B8").Value
.Body = Range("B10").Value

.Display
End With
End Sub
 
Upvote 0
VBA Code:
Sub Test()
Dim OutObj As Object, OutMail As Object
Set OutObj = CreateObject("Outlook.Application")
Set OutMail = OutObj.CreateItem(0)

    With OutMail
        .To = Range("B6").Value
        .CC = Range("B7").Value
        .Subject = Range("B8").Value
        .Body = Range("B10").Value

        .Display
    End With
End Sub
 
Upvote 0
Welcome to the forum. Do you want the additional cells on separate lines in the body of the email? If so you can use something like

.Body =Range(B10").Value & vbCr & range("C10").value

Add the additional & vbCr & cell ids and so on

Sent from my tablet
 
Upvote 0

Forum statistics

Threads
1,226,848
Messages
6,193,315
Members
453,790
Latest member
yassinosnoo1

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