大佬教程收集整理的这篇文章主要介绍了VBA 中 HTMLbody 中的样式问题,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我在使用 VBA 设置电子邮件正文时遇到问题。我需要使用不同的字体大小和颜色@R_301_6942@电子邮件正文。因此我使用了 .@R_403_6832@Body 函数。 有一次,我执行了代码,它工作正常,但在 Outlook 显示中没有给出任何格式。 如果有人能就此问题提供帮助,我将不胜感激。
VBA 代码:
.@R_403_6832@Body = "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,176);" & ">" & "<strong>" & "Decision" & "</strong>" & "</span> :" & "<span style=" & "color: rgb(184,47);" & ">" & "Test action test action" & "</span>" & "<br>" & _
"<span style=" & "color: rgb(41,176);" & ">" & "<strong>Due Date " & "</strong>" & "</span> :" & "<span style=" & "color: rgb(184,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>"
那是因为你错了一半。如果它不起作用,那么看看 VBA 将如何格式化它。一个错误: style=
后没有引号自己测试一下:
Option Explicit
Sub test()
Dim HTMLBody As String
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,176);" & ">" & "<strong>" & "Decision" & "</strong>" & "</span> :" & "<span style=" & "color: rgb(184,47);" & ">" & "Test action test action" & "</span>" & "<br>" & _
"<span style=" & "color: rgb(41,176);" & ">" & "<strong>Due Date " & "</strong>" & "</span> :" & "<span style=" & "color: rgb(184,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>" & vbCrLf
Debug.Print HTMLBody
End Sub
以上是大佬教程为你收集整理的VBA 中 HTMLbody 中的样式问题全部内容,希望文章能够帮你解决VBA 中 HTMLbody 中的样式问题所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。