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?
Thank you,
Fel
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