【发布时间】:2016-12-21 19:36:53
【问题描述】:
我正在使用以下代码生成并打开 Outlook 电子邮件。但是我需要能够插入一个带有一些变量的表格,而我当前的方法只允许基本文本,有人可以建议一种我可以整合表格的方法吗?
Try
lblStatus.Text = "Opening OutLook Mail, Please Wait..."
My.Application.DoEvents
Dim Outl As Object
Outl = CreateObject("Outlook.Application")
If Outl IsNot Nothing Then
Dim omsg As Object
omsg = Outl.CreateItem(0)
omsg.body = "Table should go here"
omsg.To = "*address goes here"
omsg.subject = SubjectLine
'set message properties here...'
omsg.Display(false) 'will display message to user
lblStatus.Text = "Outlook Mail Template Opened."
My.Application.DoEvents
End If
Catch ex As Exception
lblStatus.Text = "Opening OutLook Mail | Error Encountered"
My.Application.DoEvents
'log error
End Try
下面是表格的示例:
显然 Outlook 使用了格式化代码,但我不知道如何将它从 Visual Basic 发送到电子邮件中。
【问题讨论】:
-
HTMLBody = true。然后你就可以很容易地建表了。 -
我不想使用 HTML,因为接收器可能没有启用它,因此不会一直正确显示。我目前的想法是让vb编辑一个.oft的outlook模板。