好的,这是更新版本......但仍无法正常工作
NextHTMLBody = nextMessage.HTMLBody
NextHTMLBody = Replace(NextHTMLBody, "%Customer_Name%", bBodyName)
NextHTMLBody = Replace(NextHTMLBody, "%##%", formPage.Controls("LoanNumber1").Value)
With nextMessage
.HTMLBody = NextHTMLBody
.Subject = subjEmail
.To = sendTo
.Send
End With
-------------这里有效..不知道我做了什么不同
'Set body
NextHTMLBody = nextMessage.HTMLBody
NextHTMLBody = Replace(NextHTMLBody, "%Customer_Name%", bBodyName)
NextHTMLBody = Replace(NextHTMLBody, "%##%", formPage.Controls("LoanNumber1").Value)
With nextMessage
.HTMLBody = NextHTMLBody
'.Body = NextHTMLBody
.Subject = subjEmail
.To = sendTo
'.Send
.Display
End With
答案 0 :(得分:0)
替换应该在这里工作正常:
If InStr(nextMessage.HTMLBody, "%Customer_Name%") <> 0 Then
NextHTMLBody = Replace(nextMessage.Body, "%Customer_Name%", bBodyName)
End If
但是在下一个区块中,您将通过返回nextMessage.HTMLBody
而不是继续使用NextHTMLBody
来放弃您在上面执行的替换。你也从HTMLBody
切换到Body
:不确定是否有共鸣。
If InStr(nextMessage.HTMLBody, "%##%") <> 0 Then
NextHTMLBody = Replace(nextMessage.HTMLBody, "%##%", _
formPage.Controls("LoanNumber1").Value)
End If
最好的选择是更像这样的东西(你真的不需要If-Then):
NextHTMLBody = nextMessage.HTMLBody
NextHTMLBody = Replace(NextHTMLBody, "%Customer_Name%", bBodyName)
NextHTMLBody = Replace(NextHTMLBody, "%##%", _
formPage.Controls("LoanNumber1").Value)