使用此代码:
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set doc = New NotesDocument( db )
doc.Form = "hardware1"
doc.SendTo = "email1"
doc.Subject = "Here's the document you wanted"
Call doc.Send( True )
End Sub
我收到了通过电子邮件发送的实际表单,但表单中没有包含任何数据。
答案 0 :(得分:2)
在您的示例代码中,您创建一个表单为“hardware1”的新文档并发送该空文档。
如果代码在表单中的按钮中,那么您可以使用NotesUiWorkspace获取“当前”文档:
Dim ws as New NotesUiWorkspace
Set doc = ws.CurrentDocument.Document
'- here comes your send code
注意:默认情况下,send-命令会保存文档,除非您将属性savemessageonsend设置为false doc.savemessageonsend=false
此外,文档可能会通过发送它获得一些您不想要的其他字段。在这种情况下,请发送文件的副本:
Dim docMemo as NotesDocument
Dim ws as New NotesUiWorkspace
Set docMemo = New NotesDocument( db )
Set doc = ws.CurrentDocument.Document
Call doc.CopyAllItems( docMemo )
docMemo.Subject = "email"
docMemo.SaveMessageOnSend = False
Call docMemo.Send( True )