Macro to copy data from excel to outlook

JannetteChristie

Board Regular
Joined
Dec 14, 2015
Messages
127
Office Version
  1. 365
I have the following code, but I am struggling to get the final part done. THe email body is blank and I cannot work out what I am doing wrong.

Sub SendOutEmail()
Dim rng As Range
Dim rngAddress As String
Dim OutApp As Object
Dim OutMail As Object
Dim PNGFile As String
Dim SheetToSend As String
Dim Subject As String
Dim EmailBody As String

Subject = ActiveSheet.Range("EmailSubject")

With Application
.EnableEvents = False
.ScreenUpdating = False
End With


Set rng = Nothing
Set rng = Sheets("Spec Details").Range("ReportLayout")


Call HideBlankRows



Rows("1:99").Hidden = False

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)


On Error Resume Next
With OutMail
.to = "" _
& "sales@dutypoint.com; "
.Subject = Subject

.HTMLBody = "<span style='font-size:10.5pt; font-family:arial' ><br /><br />" _
& "<img src='" & PNGFile & "'<br /><br />" _



.Display
End With
On Error GoTo 0

With Application
.EnableEvents = True
.ScreenUpdating = True
End With


Hope someone can help.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

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