JestersTear
New Member
- Joined
- Feb 10, 2014
- Messages
- 2
Hello. Is there any way to programatically (by VBA) add an attachment to an invitation meeting in Lotus Notes? A lot of google-ing did not clearly reveal the method. Below is my code which blocks at line '*** Call objNotesRichTextItem.EmbedObject(1454, "", Attachment1, "") ***
Sub Send_meeting_Invitation()
Attachment1 = "C:\Training_plan.xls"
Set Notes = CreateObject("Notes.NotesSession") ' create new messaje
UserName = Notes.UserName
Set Db = Notes.GETDATABASE(vbNullString, "names.nsf")
Set WorkSpace = CreateObject("Notes.NotesUIWorkspace")
Call WorkSpace.COMPOSEDOCUMENT(, , "Appointment")
Set uidoc = WorkSpace.CURRENTDOCUMENT 'UIDoc=CalenDoc
Call uidoc.FieldSetText("StartDate", "11.02.2014")
Call uidoc.FieldSetText("StartTime", "12:00:00")
Call uidoc.FieldSetText("EndDate", "11.02.2014")
Call uidoc.FieldSetText("EndTime", "12:30:00")
Call uidoc.FieldSetText("Subject", "Training plan")
Call uidoc.GotoField("Body")
Call uidoc.InsertText("Please find attached also the training plan.")
Call uidoc.InsertText("" + vbCrLf)
Call uidoc.InsertText("Thank you.")
Call uidoc.InsertText("" + vbCrLf)
Call uidoc.InsertText("" + vbCrLf)
Call uidoc.FieldSetText("EnterSendTo", john.doe@xyz.com)
Set objNotesRichTextItem = uidoc.Document.CREATERICHTEXTITEM("Body")
Call objNotesRichTextItem.EmbedObject(1454, "", Attachment1, "") 'here the code stops by generating Run-time error 91: Object variable or With block variable not set
uidoc.Refresh
uidoc.Save
uidoc.Close
End Sub
Thank you.
Sub Send_meeting_Invitation()
Attachment1 = "C:\Training_plan.xls"
Set Notes = CreateObject("Notes.NotesSession") ' create new messaje
UserName = Notes.UserName
Set Db = Notes.GETDATABASE(vbNullString, "names.nsf")
Set WorkSpace = CreateObject("Notes.NotesUIWorkspace")
Call WorkSpace.COMPOSEDOCUMENT(, , "Appointment")
Set uidoc = WorkSpace.CURRENTDOCUMENT 'UIDoc=CalenDoc
Call uidoc.FieldSetText("StartDate", "11.02.2014")
Call uidoc.FieldSetText("StartTime", "12:00:00")
Call uidoc.FieldSetText("EndDate", "11.02.2014")
Call uidoc.FieldSetText("EndTime", "12:30:00")
Call uidoc.FieldSetText("Subject", "Training plan")
Call uidoc.GotoField("Body")
Call uidoc.InsertText("Please find attached also the training plan.")
Call uidoc.InsertText("" + vbCrLf)
Call uidoc.InsertText("Thank you.")
Call uidoc.InsertText("" + vbCrLf)
Call uidoc.InsertText("" + vbCrLf)
Call uidoc.FieldSetText("EnterSendTo", john.doe@xyz.com)
Set objNotesRichTextItem = uidoc.Document.CREATERICHTEXTITEM("Body")
Call objNotesRichTextItem.EmbedObject(1454, "", Attachment1, "") 'here the code stops by generating Run-time error 91: Object variable or With block variable not set
uidoc.Refresh
uidoc.Save
uidoc.Close
End Sub
Thank you.