使用对象“Outlook.Application”,我使用 VBA Access 发送电子邮件。在正文中,我放置了这样的字符串:
Email = "Random things" & Chr(13) _
& "More random things" & Chr(13) _
Run Code Online (Sandbox Code Playgroud)
Email如果我在 a 中显示字符串,MsgBox它会正确显示,但是当我发送它时,换行符会被删除。
我尝试过:
Chr(13)vbCrLfvbCr但三者都有相同的结果:

尝试这个:
Sub OutlookEmail()
Dim AppOutlook As Outlook.Application
Set AppOutlook = CreateObject("Outlook.application")
Dim Mail As MailItem
Set Mail = AppOutlook.CreateItem(olMailItem)
Dim Email As String
Email = "Random things" & vbNewLine _
& "More random things" & vbNewLine
'Generate Email
Mail.Subject = "Test Subject"
Mail.To = "Test@test.com"
Mail.Body = Email
Mail.Display
Set Mail = Nothing
Set AppOutlook = Nothing
End Sub
Run Code Online (Sandbox Code Playgroud)
我自己测试了一下,似乎可以在我的电脑上正常工作。
| 归档时间: |
|
| 查看次数: |
19873 次 |
| 最近记录: |