我尝试使用此Microsoft Word宏将我已完成的选择粘贴到新电子邮件中,但当我以HTML格式执行时,虽然每个段落末尾没有<br>
,但结果是句子一字一句地没有回车。
实施例:
文本1
文本2
文本3
我得到:
Text1 Text2 Text3
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Set rng = ActiveDocument.Range(Start:=Selection.Start, End:=Selection.End)
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
On Error Resume Next
With OutMail
.Display
.To = "to@email.com"
.CC = "cc@email.com"
.BCC = ""
.Subject = Date
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><body><font face=""calibri"" style=""font-size:11pt;""><br>" & rng & _
"<br><br></body>" & _
"Best Reagrds" & _
.HTMLBody & "</font>"
.Text
答案 0 :(得分:0)
在您的代码中尝试此操作(未经测试)
dim sen as variant
.HTMLBody = "<HTML><body><font face=""calibri"" style=""font-size:11pt;""><br>"
for each sen in rng.sentences
.htmlbody = .htmlbody & sen & "<br>" ' may have to be sen.text
next sen
....