vba - vba Outlook 在内容和签名之间添加换行符
问题描述
嗨,在粘贴表格和签名后尝试在我的正文内容之间添加换行符,代码如下:
dim FileName As String
Dim filepath As String
Dim rng As Range
Dim OutlookApp As Object
Dim Outlookmail As Object
Dim lastrowo As Integer
Application.ScreenUpdating = False
Set OutlookApp = CreateObject("Outlook.Application")
Set Outlookmail = OutlookApp.CreateItem(0)
lastrowo = Worksheets("Price And Accrued Info").Range("K550").End(xlUp).row
Set rng = Worksheets("Price And Accrued Info").Range("K2:y" & lastrowo)
rng.Copy
Dim vInspector As Object
Set vInspector = Outlookmail.GetInspector
Dim wEditor As Object
Set wEditor = vInspector.WordEditor
With Outlookmail
.To = ""
.cc=""
.Subject = "UNCONFIRMED TRADES AS OF " & Format$(Date, "YYYY.MM.DD")
wEditor.Paragraphs(1).Range.Text = "Hi The following trades are unconfirmed trades."
wEditor.Paragraphs(2).Range.Paste
wEditor.Paragraphs(4).Range.Text = vbNewLine & "<br>"
.display
' .attachments.Add drWorkbook.FullName
' .attachments.Add crWorkbook.FullName
'
End With
Set Outlookmail = Nothing
Set OutlookApp = Nothing
Application.ScreenUpdating = True
解决方案
尝试这个:
With Outlookmail
.To = ""
.cc = ""
.Subject = "UNCONFIRMED TRADES AS OF " & Format$(Date, "YYYY.MM.DD")
wEditor.Paragraphs(1).Range.Text = "Hi The following trades are unconfirmed trades." _
& String(5, vbNewLine)
wEditor.Paragraphs(5).Range.Text = "This is is the last line." _
& vbNewLine & vbNewLine
wEditor.Paragraphs(3).Range.Paste
.display
End With
推荐阅读
- javascript - Selenium 等待元素变得可见
- prolog - 使用约束在 ECLiPSe Prolog 中修剪对称解决方案
- swift - 命名函数参数中断闭包赋值的类型推断
- html - 为什么@media (max-device-width: 360px) 会受到@media (max-device-width: 1024px) 的影响?
- c# - 有没有办法突出显示自定义数据网格中的项目?
- javascript - 所有行的固定列行高
- python-3.x - 使用 DictReader 读取包含可变数量的具有相同字段名的字段的 csv 文件
- r - 为什么while循环没有正确退出?
- python - 如何使用 robobrowser 抓取“aria-label”
- r - 重塑列名中有年份的数据框