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
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
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!