vba 邮件body html,excel - Change HTML email body font type and size in VBA - Stack Overflow

I have a VBA script that that generates and email when a VBA button is pushed in a given worksheet.

The script currently generates the email in a relatively small font. I was wondering if there is a way to set the font to Calibri, and the text sive to exactly 11.

Here is the current VBA script:

Private Sub CommandButton1_Click()

Dim OutApp As Object

Dim OutMail As Object

Dim strbody As String

Dim strUser As String

Dim signature As String

Dim sTo As String

Dim sCC As String

'For To field

Set emailRng = Worksheets("Send Email").Range("D3:I6")

For Each cl In emailRng

sTo = sTo & ";" & cl.Value

Next

sTo = Mid(sTo, 2)

'For CC field

Set emailRngCC = Worksheets("Send Email").Range("D8:I11")

For Each cl In emailRngCC

sCC = sCC & ";" & cl.Value

Next

sCC = Mid(sCC, 2)

Set OutApp = CreateObject("Outlook.Application")

Set OutMail = OutApp.CreateItem(0)

With OutMail

.Display

End With

signature = OutMail.HTMLBody

strbody = "Good Morning;

We have completed our main aliasing process for today. All assigned firms are complete. Please feel free to respond with any questions.

Thank you."

With OutMail

.SentOnBehalfOfName = ""

.To = sTo

.CC = sCC

.BCC = ""

.Subject = "Data Morning Alias Process - COMPLETE"

.HTMLBody = strbody & signature

.Display

End With

End Sub

I know that this portion of the code:

strbody = "Good Morning;

We have completed our main aliasing

is the portion that relates to the email body text size. But a setting of 3 is to small, and a setting of 4 is too big. So I was just wondering if there is some way I can set the font to be exactly size 11, and the text to be formatted as Calibri?

Thank you!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值