How to send email with HTML email body in Excel?
If you want to send an email with HTML format body content in Excel, a method in this article can help you.
Please do as follows to send an email with HTML format body content in Excel.
1. Press the Alt + F11 simultaneously to open the Microsoft Visual Basic for Applications window.
2. In the Microsoft Visual Basic for Applications window, click Insert > Module. Then copy below VBA code into the Module window.
VBA code: Send email with HTML email body in Excel
Sub SendEmailformattext() 'Update by Extendoffice.com Dim xRg As Range Dim xRgEach As Range Dim xRgVal As String Dim xAddress As String Dim xOutApp As Outlook.Application Dim xMailOut As Outlook.MailItem On Error Resume Next xAddress = ActiveWindow.RangeSelection.Address Set xRg = Application.InputBox("Please select email address range", "KuTools For Excel", xAddress, , , , , 8) If xRg Is Nothing Then Exit Sub Application.ScreenUpdating = False Set xOutApp = CreateObject("Outlook.Application") Set xRg = xRg.SpecialCells(xlCellTypeConstants, xlTextValues) For Each xRgEach In xRg xRgVal = xRgEach.Value If xRgVal Like "?*@?*.?*" Then Set xMailOut = xOutApp.CreateItem(olMailItem) With xMailOut .Display .To = xRgVal .Subject = "Test" .HTMLBody = "<HTML><BODY><span style=""color:#80BFFF"">Font Color</span style=""color:#80BFFF""> <br>the <b>bold text</b> here.</br> <br><u>New line with underline</u></br><br><p style='font-family:calibri;font-size:25'>Font size</br></p></BODY></HTML>" '.Send End With End If Next Set xMailOut = Nothing Set xOutApp = Nothing Application.ScreenUpdating = True End Sub
3. Click Tools > References, check the Microsoft Outlook Object Library box in the References – VAProject dialog box, and then click the OK button. See screenshot:
4. Press the F5 key to run the code. In the popping up Kutools for Excel dialog box, select the recipients’ email addresses and then click the OK button.
Then email with specified fields and HTML body is created. Please click the Send button to send it.
Easily send email through Outlook based on created mailing list:
The Send Emails utility of Kutools for Excel helps users sending email through Outlook based on created mailing list in Excel as the below screenshot shown.
Download and try it now! ( 30-day free trail)
- How to automatically send email based on cell value in Excel?
- How to insert signature into Outlook email when sending by vba in Excel?
- How to send email with specified bold/size/color/underline text format in Excel?
- How to send email without Outlook in Excel?
- How to send a specific chart in an email with vba in Excel?
- How to send an email at specific time of a day in Excel?
You are guest
or post as a guest, but your post won't be published automatically.
To post as a guest, your comment is unpublished.· 2 years agoi have my mail signature for default. however once i run the macro the message delete the mail signature from the new mail. Do you know how is possible mantein it ? thank you!!! Best Regards