Sub Mail_Workbook_1()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
' Change the mail address and subject in the macro before you run it.
With OutMail
.Sentonbehalfofname = "xxxxx"
.To = "xxxxx"
.CC = ""
.BCC = ""
.Subject = "Outstanding LC Balances Report" & " " & Format$(Date, "mm-dd-yyyy")
.Body = "Good Afternoon," & vbNewLine & vbNewLine & _
"Please provide the LC activity report(statement)as of" & "" & Format$(Date, "mm-dd-yyyy.") & vbNewLine & _
"Please provide report in excel format for our month end reconcilliation." & vbNewLine & vbNewLine & _
"Please let us know if you have any questions." & vbNewLine & vbNewLine & _
"Thank You," & vbNewLine & vbNewLine & _
"xxxx" & vbNewLine _
"xxxx"
答案 0 :(得分:1)
.Body = "Good Afternoon," & vbNewLine & vbNewLine & _
"Please provide the LC activity report(statement)as of" & "" & Format$(Date, "mm-dd-yyyy.") & vbNewLine & _
"Please provide report in excel format for our month end reconcilliation." & vbNewLine & vbNewLine & _
"Please let us know if you have any questions." & vbNewLine & vbNewLine & _
"Thank You," & vbNewLine & vbNewLine & _
"xxxx" & vbNewLine & "xxxx"
这很简单。您应该_
进行续行,只要您还要添加其他字符串,就可以使用&
。
在您的帖子中,最后一行(下方)有_
而不是& _
。
此
"xxxx" & vbNewLine _
"xxxx"
应该是
"xxxx" & vbNewLine & _
"xxxx"
或
"xxxx" & vbNewLine & "xxxx"
编辑:通过逐行添加内容来隔离问题,以隔离导致整个语句出现语法错误的违规行。
答案 1 :(得分:0)
Debug.Print "Good Afternoon," & vbNewLine & vbNewLine & _
"Please provide the LC activity report(statement)as of" & "" & Format$(Date, "mm-dd-yyyy.") & _
"Please provide report in excel format for our month end reconcilliation." & vbNewLine & vbNewLine & _
"Please let us know if you have any questions." & vbNewLine & vbNewLine & _
"Thank You," & vbNewLine & vbNewLine