VBA更改邮件字体
我创建了一个VBA代码,但是邮件的字体和大小不正确。我想要Calibri 11,但第一行的Calibri 10(Hello),其余的Verdana 10。如何进行?
Sub mail_outlook()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.SentOnBehalfOfName = "xxxxxxxxxxxx"
.Display
.To = "xxxxxxxxxxxxxxxxxx"
.HTMLBody = "Hello, " & "<br>" & "<br>" & "Please find in attachment the Report." & "<br>" & "We remain available should you have any questions." & .HTMLBody
.CC = "xxxxxxxxxxxxxxx"
.BCC = ""
.Subject = "Report"
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
I created a vba code but the font and the size of the mail are incorrect. I would like Calibri 11 but it's Calibri 10 for the first line (Hello) and Verdana 10 for the rest. How to proceed?
Sub mail_outlook()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.SentOnBehalfOfName = "xxxxxxxxxxxx"
.Display
.To = "xxxxxxxxxxxxxxxxxx"
.HTMLBody = "Hello, " & "<br>" & "<br>" & "Please find in attachment the Report." & "<br>" & "We remain available should you have any questions." & .HTMLBody
.CC = "xxxxxxxxxxxxxxx"
.BCC = ""
.Subject = "Report"
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
You can specify the font size in the HTML:
See Change HTML电子邮件主体字体类型和VBA中的大小有关更多信息。
另外,您可以使用“对象模型”一词来编程执行此操作。 wordeditor Inspector类的wordeditor 代表消息主体的单词对象模型的文档类实例。参见第17章:与物体有关更多信息。例如,在Word中,您可以使用以下属性调用序列:
You can specify the font size in the HTML:
See Change HTML email body font type and size in VBA for more information.
Also you may use the Word object model for doing that programmatically. The WordEditor of the Inspector class returns an instance of the Document class from the Word object model which represents the message body. See Chapter 17: Working with Item Bodies for more information. For example, in Word you could use the following sequence of property calls: