VBA-使用Lotus Notes插入身份的电子邮件 [英] VBA-Insert body of email above signature using Lotus Notes

查看:1032
本文介绍了VBA-使用Lotus Notes插入身份的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要实现的是非常简单的,在Lotus Notes中插入一个电子邮件的身份在签名之上。我在vba中的代码运行时,在主题,SendTo和Body字段中的Lotus Notes贴纸中打开一个新的电子邮件窗口。一切都很完美,但当身体插入时,将文本放在我的签名下方。我已经做了大量的挖掘尝试找到一个解决方案,但没有找到任何正确的工作。我发现几个帖子显示删除签名,粘贴身体,然后重新签署电子邮件 - 不是真的我想要的方法。

What I am trying to achieve is very simple, insert the body of an email above the signature in lotus notes. The code I have in vba, when run, opens a new email window in lotus notes pastes in the Subject, SendTo and Body fields. Everything works perfectly, but when the body is inserted it puts the text below my signature. I've done a ton of digging to try and find a solution, but haven't found anything that has worked just right. A few posts I've found suggest removing the signature, pasting the body and then rebuilding the signature into the email--not really the approach i'd like.

这里是我的代码:

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

提前感谢任何帮助!

推荐答案

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

A different approach to set the Body content is to open the new document in edit mode (like you do at the end of your code) and then set cursor to Body field and insert the text. Your code could look like this:

    ...
    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插入身份的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆