邮件正文和签名大小不同



我有一个关于以下代码的问题,我写了在VBA发送电子邮件。一切都很正常,除了在生成电子邮件后,消息的字体与签名的字体大小不同之外,我没有什么主要的反对意见。是否可以将其严格设置为显示文本和签名具有相同的字体大小?

即使我在一行中设置了字体大小,也会发生这种情况。

strbody = "<p style=font-family:arial>Hi All,<br><br>"

替换为:

strbody = "<p style=font-family:arial; font-size:14pt>Hi All,<br><br>"

代码下面:

Sub Report()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim SigString As String
Dim Signature As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<p style=font-family:arial>Hi All,<br><br>" & _
"please see report.<br>"
SigString = Environ("appdata") & _
"MicrosoftSignaturesPodpis.htm"
If Dir(SigString) <> "" Then
Signature = GetBoiler(SigString)
Else
Signature = ""
End If
On Error Resume Next
With OutMail
.SentOnBehalfOfName = "email@address.com"
.To = "email@address.com"
.CC = "email@address.com"
.Subject = "Report"
.HTMLBody = strbody & "<br>" & Signature
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Function GetBoiler(ByVal sFile As String) As String
Dim fso As Object
Dim ts As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
GetBoiler = ts.readall
ts.Close
End Function

非常感谢您的帮助和建议!

尝试用您的格式替换MsoAutoSigclass

GetBoiler = Replace(ts.readall, "class=MsoAutoSig", "style=""font-family:arial; font-size:14pt""")

相关内容

  • 没有找到相关文章

最新更新