在VBA电子邮件中添加新行

Dan*_*and 7 excel vba excel-2007 excel-vba html-email

我正在尝试通过Excel自动发送电子邮件,但新行命令无效!我试过了<br/>, vbCrLf而且vbNewLine

.HTMLbody = "Hello" & vbNewLine & "Please find attached the above invoices and backup" & vbNewLine & _
            "Any queries please let me know" & vbNewLine & "Regards" & vbNewLine & Signature
Run Code Online (Sandbox Code Playgroud)

它只是Hello Please find attached the above invoices and backup Any queries please let me know Regards作为一条线给予!

小智 17

也许你可以试试这个:使用

.HTMLbody = "Hello" & "<br>" & "Please find attached the above invoices and backup" & "<br>"
Run Code Online (Sandbox Code Playgroud)

而不是vbnewline


小智 5

尝试将文本包装在一些基本的 HTML 标签中。

.HTMLbody = "<html><body><p>Hello</p><p>Please find attached the above invoices and backup.</p>" _
     & "<p>Any queries please let me know</p><p>Regards</p>" & Signature & "</body></html>"
Run Code Online (Sandbox Code Playgroud)

这假设签名已经是段落级别的 HTML 格式。(未经测试;不保证)