簡體   English   中英

VBA-使用Lotus Notes在簽名上方插入電子郵件正文

[英]VBA-Insert body of email above signature using Lotus Notes

我要達到的目的非常簡單,將一封電子郵件正文插入蓮花筆記中的簽名上方。 運行時,我在vba中擁有的代碼會在Lotus Notes粘貼中的“主題”,“發送至”和“正文”字段中打開一個新的電子郵件窗口。 一切正常,但插入主體后,它將文字置於我的簽名下方。 我已經進行了大量的挖掘工作以嘗試找到解決方案,但是還沒有發現任何可以正常工作的方法。 我發現的一些帖子建議刪除簽名,粘貼正文,然后將簽名重新構建到電子郵件中,這並不是我想要的方法。

這是我的代碼:

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"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM