在VBA电子邮件中添加新行

我试图通过Excel自动发送电子邮件,但是新的命令行不起作用! 我试过<br/>vbCrLfvbNewLine

 .HTMLbody = "Hello" & vbNewLine & "Please find attached the above invoices and backup" & vbNewLine & _ "Any queries please let me know" & vbNewLine & "Regards" & vbNewLine & Signature 

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

可能是你可以尝试这个,而不是:使用

 .HTMLbody = "Hello" & "<br>" & "Please find attached the above invoices and backup" & "<br>" 

而不是vbnewline

尝试在一些基本的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>" 

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

除非你需要HTML格式的电子邮件,否则请使用.body而不是.html。

如果你需要电子邮件是HTML,那么你需要确保整个文本格式为Html标签。 – 最简单的方法是在工作簿的单元格中添加html代码,然后引用这个单元格。