【问题标题】:Remove Additional Line Break Automatically Created删除自动创建的附加换行符
【发布时间】:2021-12-06 14:18:22
【问题描述】:

我有以下不完整的代码:

Private Sub CommandButton1_Click()
'Updated by Extendoffice 2017/9/14
    Dim xOutApp As Object
    Dim xOutMail As Object
    Dim xMailBody As String
    On Error Resume Next
    Set xOutApp = CreateObject("Outlook.Application")
    Set xOutMail = xOutApp.CreateItem(0)
    xMailBody = "** We need all of the following to get the control points to set up the Point Files." & vbNewLine & vbNewLine & _
              "1. Civil CAD drawing with all project grids placed in true coordinates." & vbNewLine & _
              "2. CSV or Text file with Northing, Easting and Elevation coordinates of all marked and confirmed site control locations." & vbNewLine & _
              "3. Job Site: " & vbNewLine & _
              "4. Requester Name: " & vbNewLine & _
              "5. Brief detail of reason for training need(s): "
                  On Error Resume Next
    With xOutMail
        .To = "jsmith@test.com"
        .CC = ""
        .BCC = ""
        .Subject = "INFORMATION NEEDED TO CREATE SITE AND BUILDING CONTROL"
        .Body = xMailBody
        .Display   'or use .Send
    End With
    On Error GoTo 0
    Set xOutMail = Nothing
    Set xOutApp = Nothing
End Sub

#2 上的文本更长,并且由于某种原因创建了一个额外的行,如下所示: ** 我们需要以下所有内容来获取控制点来设置点文件。

  1. Civil CAD 绘图,所有项目网格都放置在真实坐标中。

  2. CSV 或文本文件,其中包含所有标记和确认的测试的北距、东距和高程坐标,以查看这是否有效

  3. 工作地点:

  4. 请求者姓名:

  5. 需要培训的原因的简要说明:

谁能帮我纠正这个问题。 谢谢!

【问题讨论】:

    标签: vba outlook


    【解决方案1】:

    您可以添加 <pre> 标签并使用 HTMLBody

     xMailBody = "<pre style=""font-family:verdana"">** We need all of the following to get the control points to set up the Point Files." & vbNewLine & vbNewLine & _
                  "1. Civil CAD drawing with all project grids placed in true coordinates." & vbNewLine & _
                  "2. CSV or Text file with Northing, Easting and Elevation coordinates of all marked and confirmed site control locations." & vbNewLine & _
                  "3. Job Site: " & vbNewLine & _
                  "4. Requester Name: " & vbNewLine & _
                  "5. Brief detail of reason for training need(s): </pre>"
    
        With xOutMail
            .To = "jsmith@test.com"
            .CC = ""
            .BCC = ""
            .Subject = "INFORMATION NEEDED TO CREATE SITE AND BUILDING CONTROL"
            .HTMLBody = xMailBody
            .Display   'or use .Send
        End With
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-18
      • 2013-07-28
      相关资源
      最近更新 更多