Not able to paste image in email body using outlook 2016

ganeshpoojary05

Board Regular
Joined
Apr 26, 2011
Messages
105
Hello Everyone,

I'm using outlook 2016 and Excel 2016. I have written a code to paste a email in the outlook body, the code works fine however I'm not able to paste the image in the email body. Please help.

Please find the vba code below.

Sub Send_Mails()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim subj As String
Dim recp As String
Dim bccrep As String
Dim ccrecp As String

Dim i As Integer


For i = 2 To 10

Sheets("Email Draft").Select

strbody = Sheets("Email Draft").Range("C1")
subj = "Welcome - " & Sheets("Macro").Range("O" & i)
recp = Sheets("Macro").Range("I" & i)
ccrecp = Sheets("Macro").Range("J" & i)
bccrep = Sheets("Macro").Range("K" & i)

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

'On Error Resume Next

With OutMail
.To = recp
.CC = ccrecp
.BCC = bccrep
.Subject = subj
.HTMLBody = .HTMLBody & strbody
.Display


End With

'On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

Next i

End Sub

Please find below my html code which is updated as strbody.

<p><font face="calibri" size="3">Dear Colleagues,</p>


<p>We are pleased to inform you the appointment of <strong>Ganesh Poojary </strong>as <strong>Manager</strong> - <strong>Human Resource</strong>.</p>


<img alt="" src="file:Z:/MIS/2018-19/6.September - 2018/Ganesh.jpg" height="152" width="124"/>








<p>Ganesh will be based out of <STRONG>Mumbai</STRONG>. He will report to <STRONG>Rahul.</STRONG></p>


<p>Ganesh has previously worked with Altisource as Specialist HR, Operations. He holds a MBA in HR from Sikkim Manipal University.</p>
<p>In his spare time, Ganesh loves to read, watch television and play football.</p>
<p>We wish Ganesh luck and continued success in his endeavours.</p>


<br><STRONG>Thanks and Regards,</br>
<br>Human Resources Team</font> </STRONG></br>
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

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