【发布时间】:2016-05-10 13:27:54
【问题描述】:
我已经断断续续地解决这个问题大约 3 周了。我创建了一个 Outlook 自定义表单,让用户可以输入我创建的用户定义字段(我们称之为 myField1、myField2)以及标准 收件人、抄送、主题、日期字段。
用户填写表单,单击发送,而不是将自定义表单发送给收件人,我希望它发送(HTML?)我的用户定义字段并关闭表单窗口。这允许收件人查看和打印输入的字段并在 Outlook 的预览窗格中呈现可读性。我是否应该探索 Outlook 区域表单以完成我想要做的事情?我现在拥有的代码不会产生错误,但它什么也没做! - 表格作为表格发送。我只能访问 Outlook 2010 中的脚本编辑器。非常令人沮丧..
Function Item_Send()
'Dim olApp As Outlook.Application
'Dim objNS As Outlook.NameSpace
'Dim mailItem As Outlook.mailItem
Set olApp = CreateObject("Outlook.Application")
'Outlook.ApplicationClass _app = new Outlook.ApplicationClass();
'Outlook.Application olApp = (Outlook.Application)_app
'Outlook.NameSpace olNameSpace = _app.GetNamespace("MAPI")
'Create mail item
'Set objMail = myOlApp.GetItem(OlItemType.olMailItem)
Set mailItem = Application.CreateItem(olMailItem)
'Outlook.mailItem mailItem = (Outlook.mailItem)olApp.CreateItem(Outlook.OlItemType.olMailItem)
'With mailItem
mailItem.Subject = item.Subject
mailItem.Recipients.Add ("emails that I typed into the To: box")
mailItem.Body = "This is the Body of an e-mail message"
'Set body format to HTML
mailItem.BodyFormat = 2
mailItem.HTMLBody = "<HTML><H2>The body of this message will appear in HTML.</H2><BODY>Type the message text here. </BODY></HTML>"
mailItem.Send()
'End With
'Set olMailItem = Nothing
Set olApp = Nothing
End Function
【问题讨论】:
标签: html forms vba email outlook