.HTMLBody not working

Nishantv02

New Member
Joined
Oct 8, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi,
I was using this code for the past 4 months to send email by setting up a template for the main body so that my template is intact in HTML format with my signature and link but it stopped working today.

Can anyone help?

VBA Code:
Option Explicit

Sub Send_email_fromexcel()

Dim EApp As Object

Set EApp = CreateObject("Outlook.Application")



Dim Eitem As Object



'Dim EApp As Outlook.Application

Set EApp = New Outlook.Application



'Dim Eitem As Outlook.MailItem

Set Eitem = EApp.CreateItem(olMailItem)



Dim path As String

path = "File path"



Dim RList As Range

Set RList = Range("B2", Range("b2").End(xlDown))



Dim R As Range



For Each R In RList

Set Eitem = EApp.CreateItem(0)



With Eitem

.To = R.Offset(0, 0)

.Subject = "Ebill: " & R.Offset(0, 1)

.Attachments.Add (path & R.Offset(0, 2))

.Display



.HTMLBody = "Good Morning!" & .HTMLBody





End With



Next R





End Sub

It is populating only the attachment with the body as- Good Morning! but not retrieving the template
 
Last edited by a moderator:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Welcome to MrExcel!

path = "File path"
Are you filling in the full folder name where the files are located?
Do the names of the files you have in column D exist in that folder?
At the end of the path are you putting "\"?

Does it send you an error message?
What does the error message say?
On which line of the macro does execution stop?

Help us help you, try to provide all the relevant information.
 
Upvote 0

Forum statistics

Threads
1,223,879
Messages
6,175,150
Members
452,615
Latest member
bogeys2birdies

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