HTML Code Text in VBA Code

seenai

Board Regular
Joined
Mar 31, 2013
Messages
54
Hi,

I need the below formatted text in the Excel VBA Code to appear as Message Body. (in place of MyItem.Body in Code). Thanks in advance.

Formatted Text :
Hi Sir/ Madam,

Please find the attached receipt for your donations. Your contributions are invaluable to the Children.
Thanks for your support.



Code :
HTML:
Sub receipt_mail()Dim outobj, mailobjDim MyItem As Outlook.MailItem
Set outobj = CreateObject("Outlook.Application")Set mailobj = outobj.CreateItem(O)Set MyItem = outobj.CreateItemFromTemplate("D:\ThatsMyChild\Mail.oft")
Sheets("Receipt").Activate
MMMYYY = Worksheets("Receipt").Cells(4, "AD").Value

With mailobj'.To = toMail.To = Worksheets("Receipt").Cells(6, "AE").Value
.Subject = "Receipt : " & MMMYYY
      .Body = MyItem.Body                        
.Attachments.Add (FName).SendEnd With
Set outobj = NothingSet mailobj = NothingSet objDoc = Nothing
End Sub
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,213,564
Messages
6,114,334
Members
448,567
Latest member
Kuldeep90

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