VBA – 使用Lotus Notes在签名上方插入电子邮件正文

我试图实现的是非常简单的,在莲花笔记上签名的上方插入电子邮件的正文。 我在vba中运行的代码在“主题”,“发送到”和“正文”字段中的lotus notes paste中打开一个新的电子邮件窗口。 一切工作完美,但是当插入的身体把它放在我的签名下面的文本。 我已经做了大量的挖掘工作,试图find一个解决scheme,但没有发现任何工作正确的东西。 我发现的一些postbuild议删除签名,粘贴身体,然后重新签名到电子邮件 – 不是我真正的方法。

这是我的代码:

Sub CreateEmail() Dim Notes As Object Dim Maildb As Object Dim objNotesDocument As Object Dim objNotesField As Object Set Notes = CreateObject("Notes.NotesSession") Set Maildb = Notes.GETDATABASE("", "") Maildb.OPENMAIL Set objNotesDocument = Maildb.CREATEDOCUMENT Subject = "Hey look at my email!!" Set objNotesField = objNotesDocument.APPENDITEMVALUE("Subject", Subject) Set objNotesField = objNotesDocument.APPENDITEMVALUE("SendTo", GetPrimaryEmail) 'calls a function to return the SendTo Set objNotesField = objNotesDocument.APPENDITEMVALUE("Body", bodyInfo) 'calls a function to return the body contents. Set workspace = CreateObject("Notes.NotesUIWorkspace") Call workspace.EDITDOCUMENT(True, objNotesDocument) AppActivate "Lotus Notes" End Sub 

提前感谢任何帮助!

设置正文内容的另一种方法是在编辑模式下打开新文档(就像在代码末尾那样),然后将光标设置到正文字段并插入文本。 你的代码可能是这样的:

  ... Set objNotesField = objNotesDocument.APPENDITEMVALUE("SendTo", GetPrimaryEmail) 'calls a function to return the SendTo Set workspace = CreateObject("Notes.NotesUIWorkspace") Call workspace.EDITDOCUMENT(True, objNotesDocument) Set uidocument = workspace.CurrentDocument Call uidocument.GotoField("Body") Call uidocument.InsertText(bodyInfo) 'calls a function to return the body contents. AppActivate "Lotus Notes"