1. The commented out line ...
'Set notesEmbedObject = notesAttachment.EmbedObject(EMBED_ATTACHMENT, "", stAttachment)
… was because of a note I found
'http://www.fabalou.com/VBandVBA/lotusnotesmail.asp
'Point of note. Certain versions of 4.x client handle differently.
'If you get an error on the line MailDoc.CREATERICHTEXTITEM ("Attachment"), then
'try removing that line. In later versions of notes API this task is carried out by the
'previous line. Earlier versions required the call afterwards
'if it doesn't work comment out this line
'--------------------------------------------------------------------------------------------
2. The driver sub creates the test workbook so the SendWithLotus should always find it
3. The latest grope in the dark ….
Option Explicit
'https://www.rondebruin.nl/win/s1/notes/notes4.htm
Sub SendWithLotusNew(Subject As String, Attachment As String, Recipient As String, BodyText As String)
Dim noSession As Object, noDatabase As Object, noDocument As Object
Dim obAttachment As Object, EmbedObject As Object
Const EMBED_ATTACHMENT As Long = 1454
'Instantiate the Lotus Notes COM's Objects.
Set noSession = CreateObject("Notes.NotesSession")
Set noDatabase = noSession.GETDATABASE("", "")
'If Lotus Notes is not open then open the mail-part of it.
If noDatabase.IsOpen = False Then noDatabase.OPENMAIL
'Create the e-mail and the attachment.
Set noDocument = noDatabase.CreateDocument
Set obAttachment = noDocument.CreateRichTextItem("Attachment")
Set EmbedObject = obAttachment.EmbedObject(EMBED_ATTACHMENT, "", Attachment)
'Add values to the created e-mail main properties.
With noDocument
.Form = "Memo"
.SendTo = Recipient
.Subject = Subject
.Body = BodyText
.SaveMessageOnSend = True
End With
'Send the e-mail.
With noDocument
.PostedDate = Now()
.Send 0, Recipient
End With
'Release objects from the memory.
Set EmbedObject = Nothing
Set obAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing
End Sub
Still no joy