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>
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>