gpt4 book ai didi

vba - 使用 VBA 格式化电子邮件正文

转载 作者:行者123 更新时间:2023-12-02 08:36:05 27 4
gpt4 key购买 nike

我有以下代码部分,它是我正在开发的自动回复系统的一部分。据我了解,它应该用换行符格式化电子邮件的正文,但是,正如所附的屏幕截图所示,它没有。有人可以指出我哪里出错了吗?

With NewForward
.Subject = "'TEST' Hazard report reciept number: HAZ" & IDnumber
.To = strSender
.BCC = "xxxxxxxxxxxx"
.HTMLBody = "Please accept this email as confirmation that xxxx has received your road defect notification. xxxxx will investigate and action your notification according to priority and to ensure public safety. For further information, please phone xxxxx on 4221 6111 and quote reference number " & vbCrLf & IDnumber & vbCrLf & "Your original report can be seen below:" & vbCrLf & report_body
.Send
End With

图片: Email Screenshot

最佳答案

如果您使用.HTMLBody,那么您应该使用HTML 标签 编写它。
试试这个:

Dim EBody as String

EBody = "Please accept this email as confirmation that xxxx has received your road defect notification." & "<br>" _
& "xxxxx will investigate and action your notification according to priority and to ensure public safety." & "<br>" _
& "For further information, please phone xxxxx on 4221 6111 and quote reference number:" & "<br>" _
& IDnumber & "Your original report can be seen below:" & "<br>" _
& reportbody

With NewForward
.Subject = "'TEST' Hazard report reciept number: HAZ" & IDnumber
.To = strSender
.BCC = "xxxxxxxxxxxx"
.HTMLBody = Ebody
.Send
End With

希望这对你有用。
此外,您的 reportbody 应该采用相同的格式,使用 HTML 标签

关于vba - 使用 VBA 格式化电子邮件正文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21248365/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com