Include a range of cells in the body of an email

alang84

New Member
Joined
Oct 21, 2022
Messages
22
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Sub OF()

Application.ScreenUpdating = False

Dim MyOutlook As Object
Set MyOutlook = CreateObject("Outlook.Application")
Dim MyMail As Object
Set MyMail = MyOutlook.CreateItem(olMailItem)

MyMail.To = email
MyMail.CC =
MyMail.Subject = Range("F14").Value
MyMail.Body = "Hi Team," _
& vbNewLine & vbNewLine & Range("F15").Value _
& vbNewLine & vbNewLine & Range("F16").Value _
& vbNewLine & vbNewLine & Range("F17").Value _
& vbNewLine & vbNewLine & vbNewLine & vbNewLine & vbNewLine & vbNewLine & Range("R2").Value _
& vbNewLine & Range("R3").Value _
& vbNewLine & Range("R4").Value _
& vbNewLine & Range("R5").Value _

MyMail.Display

Application.ScreenUpdating = True

End Sub


I have this code that works well. What I would like to do is include data in cells A5:A10 in the body of the email. Does anyone have any ideas? Also, is it possible to copy as a picture so that I can retain the formatting?

Thanks,

Aaron
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Copy range and paste into outlook

VBA Code:
Sub CopyRngToOutlook()
    Dim doc As Object, rng As Range
    Set rng = Sheets("Sheet1").Range("B1:G13")
    With CreateObject("Outlook.Application").CreateItem(0)
        .Display
        Set doc = .GetInspector.WordEditor
        rng.Copy
        doc.Range(0, 0).Paste
        .To = "someone@somewhere.com"
        .Subject = "Send Email Body"
    End With
End Sub

see the sample workbook.

Copy range and paste into outlook
 
Upvote 0
Copy range and paste into outlook

VBA Code:
Sub CopyRngToOutlook()
    Dim doc As Object, rng As Range
    Set rng = Sheets("Sheet1").Range("B1:G13")
    With CreateObject("Outlook.Application").CreateItem(0)
        .Display
        Set doc = .GetInspector.WordEditor
        rng.Copy
        doc.Range(0, 0).Paste
        .To = "someone@somewhere.com"
        .Subject = "Send Email Body"
    End With
End Sub

see the sample workbook.

Copy range and paste into outlook
I appreciate your response. do you know how I can modify my current macro to accomplish this?
 
Upvote 0

Forum statistics

Threads
1,224,802
Messages
6,181,048
Members
453,014
Latest member
Chris258

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