如何在Excel中以指定的粗体/大小/颜色/下划线文本格式发送电子邮件?
HTML正文格式可以丰富电子邮件并使其易于阅读。 本文讨论通过在Excel中添加粗体,下划线以及指定的大小和颜色文本格式来发送HTML格式的电子邮件正文的电子邮件。
使用VBA代码以指定的粗体/大小/颜色/下划线文本格式发送电子邮件
使用VBA代码以指定的粗体/大小/颜色/下划线文本格式发送电子邮件
请在VBA代码下方应用以在Excel中发送具有特定HTML正文格式的电子邮件。
1。 按 其他 + F11 同时打开 Microsoft Visual Basic应用程序 窗口。
2.在 Microsoft Visual Basic应用程序 窗口中,单击 插页 > 模块。 然后将下面的VBA代码复制到“代码”窗口中。
VBA代码:在Excel中以特定的粗体/大小/颜色/下划线文本格式发送电子邮件
Sub SharePerformance1()
Update by ExtendOffice 2018/3//5
Dim xOutApp As Object
Dim xOutMail As Object
Dim xOutMsg As String
On Error Resume Next
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
xOutMsg = "<b>This text is bold</b><br/><span style=""color:#80BFFF"">Font Color</span style=""color:#80BFFF""><br />" & _
"<u>New line with underline</u><br /><p style=font-family:calibri;font-size:25>Font size</p>"
With xOutMail
.To = "Email Address"
.CC = ""
.BCC = ""
.Subject = "Html format email"
.HTMLBody = xOutMsg
.Display
End With
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub
Notes:
1) Replace the .Subject line with your own one.
2) Enter the recipient’s email address into the .To line.
3) In the xOutMsg line:
3.1) <b>…</b> can make your text bold;
3.2) <span style=""color:#80BFFF"">...</span style=""color:#80BFFF""> is the text color
3.3) If you want to restart a new line, please add <br/> before the new line text;
3.4) Underline your text with <u>…</u>;
3.5) And change your text size by <p style=font-family:calibri;font-size:25>…</p>.
3. Press the F5 key to run the code. Then email with specified HTML format body is opening. Please click the Send button to send it.
Easily send email through Outlook based on fields of created mailing list in Excel:
The Send Emails utility of Kutools for Excel helps users sending email through Outlook based on created mailing list in Excel. Download and try it now! (30-day free trail)
Related articles:
How to automatically send email basd on cell value in Excel?
How to insert signature into Outlook email when sending by vba 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?
How to send email with HTML email body in Excel?
Best Office Productivity Tools
Transform Hours into Minutes with Kutools for Excel!
Ready to supercharge your Excel tasks? Harness the power of Kutools for Excel - your ultimate time-saving tool. Streamline intricate tasks and glide through your data like a pro. Experience Excel at lightning speed!
Why You Need Kutools for Excel
🛠️ Over 300 Powerful Features: Kutools is packed with more than 300 advanced features, simplifying your work in over 1500 scenarios.
📈 Superior Data Processing: Merge cells, remove duplicates, and perform advanced data conversions – all without breaking a sweat!
⏱️ Efficient Batch Operations: Why put in extra effort when you can work smart? Import, export, com
bine, and tweak data in bulk with ease.
📊 Customizable Charts and Reports: Access a broad variety of additional charts and generate insightful reports that tell a story.
🗄️ Powerful Navigation Pane: Gain an advantage with the robust Column Manager, Worksheet Manager, and Custom Favorites.
📝 Seven Types of Drop-down Lists: Make data entry a breeze with drop-down lists of various features and types.
🎓 User-Friendly: A breeze for beginners and a powerful tool for experts.
Download Now and Soar Through Time with Excel!
Read More... Free Download... Purchase...
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!
Read More... Free Download... Purchase...