VBA中电子邮件正文的字体样式 [英] Font style for e-mail body in VBA

查看:1488
本文介绍了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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆