1
votes

I am looking to insert a blank line into the body of a lotus notes email.

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.

1

1 Answers

2
votes

Add Chr(10) twice to your string. You get a blank line between text and image then

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