【发布时间】:2021-04-28 20:48:00
【问题描述】:
我在使用 VBA 设置电子邮件正文时遇到问题。我需要使用不同的字体大小和颜色自定义电子邮件正文。因此我使用了 .HTMLBody 函数。 有一次,我已经执行了它工作正常的代码,但在 Outlook 显示中没有给出任何格式。 如果有人能就这个问题提供帮助,非常感谢。
VBA 代码:
.HTMLBody = "Hi <strong>All</strong>" & "<br>" & "<br>" & _
"Your task has already overdue! Please focus your kind attention here." & "<br>" & _
"<br>" & _
"<strong>" & "<span style=" & "color: rgb(41, 105, 176);" & ">" & "Task " & "</span>" & "</strong>:" & "<span style=" & "color: rgb(184, 49, 47);" & ">" & "testing task testing task" & "</span> " & "<br>" & _
"<span style=" & "color: rgb(41, 105, 176);" & ">" & "<strong>" & "Decision" & "</strong>" & "</span> :" & "<span style=" & "color: rgb(184, 49, 47);" & ">" & "Test action test action" & "</span>" & "<br>" & _
"<span style=" & "color: rgb(41, 105, 176);" & ">" & "<strong>Due Date " & "</strong>" & "</span> :" & "<span style=" & "color: rgb(184, 49, 47);" & ">" & "21/1/2021" & "</span>" & "<br>" & _
"<br>" & "<br>" & "<br>" & _
"<span style=" & "font-size: 12px;" & ">" & "This is system generated email from Measure and Monitoring team." & "</span>" & "<br>" & _
"<span style=" & "font-size: 12px;" & ">" & "If you already completed or any convenience regarding this e mail please reply here." & "</span>" & "<br>" & _
"<span style=" & "font-size: 10px;" & ">" & "Generated Date : 1/1/2021" & "</span>" & _
"<br>"
【问题讨论】:
-
我已经执行了代码,它可以正常工作,但在 Outlook 显示中没有给出任何格式 这是什么意思?文本格式为粗体,因此它显然有效
-
嗨。不,我需要为这些词添加颜色。我使用 "