删除自动创建的额外换行符



我有以下不完整的代码:

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. 土木CAD图纸,所有项目网格以真坐标放置。

  2. CSV或文本文件,标记和确认所有的东北方和海拔坐标,测试看看这是否有效

  3. 求职网站:

  4. 请求者名称:
  5. 培训需求原因的简要细节:

有人能帮我纠正一下吗?谢谢!

您可以添加<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

最新更新