Nishantv02
New Member
- Joined
- Oct 8, 2024
- Messages
- 1
- Office Version
- 365
- Platform
- 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?
It is populating only the attachment with the body as- Good Morning! but not retrieving the template
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: