vba Outlook在内容和签名之间添加换行符

问题描述 投票:-1回答:1

您好,在粘贴表格和签名后尝试在我的身体内容之间添加换行符,代码如下:

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
vba html-email
1个回答
0
投票
您需要连接每个字符串,范围和vbNewLine。请注意,.Subject接受一个字符串,即一行代码。为了使这个更简洁,我倾向于使用_分解各个组件,该组件告诉VBA下一行代码是当前行的扩展。
© www.soinside.com 2019 - 2024. All rights reserved.