gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 21:38:39 24 4
gpt4 key购买 nike

我想要实现的非常简单,在 lotus notes 的签名上方插入电子邮件正文。我在 vba 中拥有的代码在运行时会在主题、发送到和正文字段中粘贴的莲花笔记中打开一个新的电子邮件窗口。一切正常,但是当插入正文时,它会将文本放在我的签名下方。我已经进行了大量挖掘以尝试找到解决方案,但还没有找到任何可以正常工作的方法。我发现的一些帖子建议删除签名,粘贴正文,然后将签名重建到电子邮件中——这并不是我想要的方法。

这是我的代码:

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"

关于VBA-使用 Lotus Notes 在签名上方插入电子邮件正文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25455524/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com