I’m using the code below to send email from excel via notes. This macro allows to attach files. However, I’m unable to paste excel range as image in the email body. I’m also encountering another problem - after sending the email, it appears that email is sent witout any recepient sname. When you open the email recepient names do appear in the to box. Repients do receive the emails. Any help is appreciated.
Sub SendMail()
Dim notesdb As Object
Dim notesDoc As Object
Dim notesrtf As Object
Dim notespicture As PictureFormat
Dim mypicture As Object
Dim notessession As Object
Dim arrDistrib_to(50) As String
Dim arrDistrib_copy(50) As String
Set notessession = CreateObject(“Notes.Notessession”)
Set notesdb = notessession.GetDatabase(“”, “”)
Call notesdb.openmail
Rem make new mail message
Set notesDoc = notesdb.CreateDocument
num = Range("ToList").CurrentRegion.Rows.Count
For i = 0 To num
arrDistrib_to(i) = Range("ToList").Offset(i, 0).Value
Next i
Call notesDoc.replaceitemvalue(“Sendto”, arrDistrib_to)
num = Range("CCList").CurrentRegion.Rows.Count
For i = 0 To num
arrDistrib_copy(i) = Range("CCList").Offset(i, 0).Value
Next i
Call notesDoc.replaceitemvalue(“Copyto”, arrDistrib_copy)
mySubject = Range(“Note_Subject”)
Call notesDoc.replaceitemvalue(“Subject”, mySubject)
Set notesrtf = notesDoc.CreateRichTextItem(“body”)
myText = Range("Body_text").Cells(1, 1).Value
Call notesrtf.appendtext(myText)
myText = Range("Body_text").Cells(1, 1).Value
Call notesrtf.appendtext(myText)
Call notesrtf.AddNewLine(3)
myOutput1 = Range("ToDir") '& Range("ToFolder") & Range("output1")
Call notesrtf.EmbedObject(1454, “”, myOutput1)
Rem send message
Call notesDoc.Send(False)
Call notesDoc.Save(False, True)
Set notessession = Nothing
MsgBox “Mail sent, check Inbox!”
End Sub