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?
Best Office Productivity Tools
Supports Office/Excel 2007-2021 and 365 | Available in 44 Languages | Easy to Uninstall Completely
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need Is Just A Click Away...
Supercharge Your Excel Skills: Experience Efficiency Like Never Before with Kutools for Excel (Full-Featured 30-Day Free Trial)
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day! (Full-Featured 30-Day Free Trial)