Attached a file in the Body of a Lotus Notes Email

fpskidmark

Board Regular
Joined
Sep 11, 2009
Messages
139
Dear All,

I have searched everywhere on this Forum to see if I can get the answer to my question, but unfortunately I had no luck.
Q: In Lotus Notes, how can I attach a file to the middle of a body in a email?

Currently the code below works fine, but the file is attached at the very bottom of email (underneath my signature).

Can someone please help?

Code:
Sub Email()

Dim Notes As Object, db As Object, WorkSpace As Object
Dim UIdoc As Object, AttachMe As Object, EmbedObj As Object
Dim UserName As String, MailDbName As String


Set Notes = CreateObject("Notes.NotesSession")


UserName = Notes.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, _
    (Len(UserName) - InStr(1, UserName, " "))) & "Name.sf"


Set db = Notes.GETDATABASE(vbNullString, MailDbName)
Set WorkSpace = CreateObject("Notes.NotesUIWorkspace")
Call WorkSpace.ComposeDocument(, , "Memo")


Set UIdoc = WorkSpace.CurrentDocument
Call UIdoc.FieldSetText("EnterSendTo", "xxxxxxx@ATT.NET") 'Enter Recipient
Call UIdoc.FieldSetText("Subject", "TEST") 'Enter Subject


Call UIdoc.GotoField("Body")
'Enter Message below
Call UIdoc.Inserttext(WorksheetFunction.Substitute _
("Dear Buddy@I would like to test this Macro.@@Again Still Testing@", "@", vbCrLf))


' Adding Attachment
Set AttachMe = UIdoc.Document.CreateRichtextitem("Attachment")
Set EmbedObj = AttachMe.EMBEDOBJECT(1454, vbNullString, "P:\Microsoft Word\Attendance Incentive Program\Token1.jpg", "Attachment")


Call UIdoc.Inserttext(Application.Substitute("@Thank you,", "@", vbCrLf))
Application.CutCopyMode = False


UIdoc.Document.posteddate = Now
Call UIdoc.Send(False)
Call UIdoc.Close


Set UIdoc = Nothing: Set WorkSpace = Nothing
Set db = Nothing: Set Notes = Nothing
Set EmbedObj = Nothing: Set AttachMe = Nothing


MsgBox ("Emails Sent")
End Sub

Thank you,
Fel
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,206,710
Messages
6,074,460
Members
446,071
Latest member
Jolon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top