简体   繁体   English

Excel VBA-在Lotus Notes电子邮件正文中插入空白行

[英]Excel VBA--Insert blank line in lotus notes email body

I am looking to insert a blank line into the body of a lotus notes email. 我希望在Lotus Notes电子邮件的正文中插入空白行。

For example: Currently my body displays this: 例如:当前我的身体显示以下内容:

"Hi this is the body of my email. <img></img>"

And I want the body of my email to look like this: 我希望电子邮件的正文如下所示:

"Hi this is the body of my email.

<img></img>"

How would I go about doing this? 我将如何去做呢? Any creative ideas? 有创意吗?

Here is my code: 这是我的代码:

Sub CreateEmail()

    Dim Notes As Object
    Dim Maildb As Object
    Dim objNotesDocument As Object
    Dim objNotesField As Object
    Dim notesUIDoc As Object       
    Dim chartBody As Range

    Set Notes = CreateObject("Notes.NotesSession")
    Set Maildb = Notes.GETDATABASE("", "")
    Maildb.OPENMAIL
    Set objNotesDocument = Maildb.CREATEDOCUMENT

    Subject = "Hi read me!!"
    Set objNotesField = objNotesDocument.APPENDITEMVALUE("Subject", Subject)
    Set objNotesField = objNotesDocument.APPENDITEMVALUE("SendTo", GetPrimaryEmail)
    Set objNotesField = objNotesDocument.APPENDITEMVALUE("CopyTo", GetSecondaryEmail)

    Set workspace = CreateObject("Notes.NotesUIWorkspace")
    Call workspace.EDITDOCUMENT(True, objNotesDocument)
    Set uidocument = workspace.CURRENTDOCUMENT

    'Copy and Paste diagram into email
    Set chartBody = Worksheets("Sheet1").Range("A1:G16")
    chartBody.Copy
    Call uidocument.GOTOFIELD("Body")
    Call uidocument.Paste 'Paste a diagram in the body of email. 
    'Paste in body text
    Call uidocument.GOTOFIELD("Body") 
    Call uidocument.INSERTTEXT(bodyInfo)'Calls a function to inserts the text for the body. 


    AppActivate "Lotus Notes"

End Sub

All that is happening is that I am inserting an image and then inserting text into the body of an email. 发生的一切是,我先插入图像,然后将文本插入电子邮件正文。 The problem is that the picture and text get pasted on the same line, which causes weird formatting. 问题是图片和文本粘贴在同一行上,这会导致格式奇怪。

Add Chr(10) twice to your string. Chr(10)两次添加到您的字符串中。 You get a blank line between text and image then 您会在文本和图像之间留空行,然后

Call uidocument.INSERTTEXT(bodyInfo + Chr(10) + Chr(10))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM