VBA中电子邮件正文的字体样式 [英] Font style for e-mail body in VBA
问题描述
Dim StrBody As String
StrBody = Text Line 1& <峰; br> 中&安培; _
文字行2& _
如何更改字体以获取特定样式(例如Arial),大小和颜色?
文字用作电子邮件的正文。这就是为什么一些更好的样式需要使用。默认的字体是Times New Roman。
我想象你必须使用
标签及其各种属性:
StrBody =< font size =10 face =Arialcolor =red> &安培; _
文字行1& <峰; br> 中&安培; _
文字行2& _
< / font>
确保 HTML属性值不会被解释为VBA字符串的结尾:通过写入
来转义它们,如上例所示。
color
也可以指定为十六进制RGB代码,所以 color =red
可以由更一般的 color =#FF0000
替换。
I have the following code written in VBA:
Dim StrBody As String
StrBody = "Text Line 1" & "<br>" & _
"Text Line 2" & _
How do I change the font to get a particular style (e.g. Arial), size, and color?
The text is used as the body of an e-mail. That's why some better looking style needs to be used. The default font is "Times New Roman".
I imagine you would have to use the font
tag and its various attributes:
StrBody = "<font size=""10"" face=""Arial"" color=""red"">" & _
"Text Line 1" & "<br>" & _
"Text Line 2" & _
"</font>"
Make sure the "
quotes used to surround HTML attribute values don't get interpreted as the end of the VBA string: escape them by writing ""
instead, as in the example above.
color
can also be specified as hexadecimal RGB codes. So color="red"
could be replaced by the more general color="#FF0000"
.
这篇关于VBA中电子邮件正文的字体样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!