excel - 更改 Email.htmlbody 中单个单词的颜色
问题描述
我是 Excel VBA 编程的新手。我正在编写一个宏来自动从 Excel 发送电子邮件。我想知道如何更改 Email.htlmbody 中特定单词的颜色。我可以“加粗”一个词,但不知道如何改变颜色。例子:
Email.htmlbody = "<p>Hello my <b>friend</b>!</p>" & _
"<p>Please send the report by July, 30th</p>"
我怎样才能使“7 月 30 日”变成红色?
解决方案
使用 HTML 标签:
<p>Hello my <b>friend!</b></p>
<p>Please send the report by <span style="color:red">July, 30th</span></p>
当然,VBA 中的上面只是一个字符串,所以它应该用"
引号引起来。
推荐阅读
- xml - Reverse-engineer a Word DOCX generated by XML back to XML
- php - 无法在子主题中向自定义 wp 用户角色添加功能
- c# - AsNoTracking method throwing error in linq statement
- sql - 在一列中结合一个案例和一个 Coalese
- python - 使用扩散方程的矩阵求逆计算沿棒的温度分布
- networking - Fiddler:在哪里为 m_SimulateModem 添加 IF 语句?
- jboss - Openshift / Keycloak 4.8.3。登录到管理控制台无限重定向循环
- databricks - Databricks - How to change a partition of an existing Delta table?
- python - Python 列表连接——在开头或结尾包含分隔符
- javascript - 如何使用 map 反转数组?