Help with Copying a range to an Outlook Email

kkernohan

Board Regular
Joined
May 7, 2010
Messages
53
Hi, I have been trying to find help on this on the internet and I cant find an answer. It seems lots of people have this same question just from what I've seen but I dont see any solution out there.

I am doing a basic create email function from excel which sends out an email with certain information in it.

Here is the code that I have for creating the email and sending it. This code works fine when I am just using the body as "test". My problem occurs when trying to set the body equal to a range.

I have stripped the code down to hopefully make it easier to read/answer

Code:
Sub emailtesting()
 
Dim oLookApp As Outlook.Application
Dim oLookMail As Outlook.MailItem
Dim i As Integer
Dim EmailBody As Range
 
Set oLookApp = New Outlook.Application
Set oLookMail = oLookApp.CreateItem(0)
 
Set EmailBody = Range("A1:J5")
 
With oLookMail
 
.To = "[EMAIL="test@email.com"]test@email.com[/EMAIL]"
.Subject = "Handlings - " & Format(Date, "Long Date")
.Body = EmailBody
.Send
End With
 
End Sub




If this isnt possible to do, is there a way I can copy the range as an image and just paste the image into the email?

Thanks in advance for any help.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Sorry one other thing is that I would like to keep the same format that I have in excel. If not thats fine but if this changes any answer I would prefer the same formatting.

Thanks!
 
Upvote 0
solved:

Code:
Sub emailtesting()
 
Dim oLookApp As Outlook.Application
Dim oLookMail As Outlook.MailItem
Dim i As Integer
Dim EmailBody As Range
For i = 1 To 17
Set oLookApp = New Outlook.Application
Set oLookMail = oLookApp.CreateItem(0)
 
Set EmailBody = Range("G" & (i * 5) - 3 & ":J" & i * 5 & "")
 
With oLookMail
 
.To = "[EMAIL="test@email.com"]test@email.com[/EMAIL]
.Subject = "Handlings - " & Format(Date, "Long Date")
.HTMLBody = RangetoHTML(EmailBody)
.Send
End With
Next i
 
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,853
Members
452,948
Latest member
UsmanAli786

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