The issue is with
.Send 0, vaRecipients
I dumbed it down to a direct link to an already existing file and it works (Below) , So I suspect that it might have something to do with how the stAttachment is being represented in the larger automated process, but I don't see an error anywhere when walking through it
Anyone have any thoughts?
Option Explicit
Const EMBED_ATTACHMENT As Long = 1454
Const stPath As String = "D:\abc123.xls"
Const stSubject As String = "whatever"
Const vaMsg As Variant = "whatever"
Sub Test_send()
Dim stFileName As String
Dim vaRecipients As Variant
Dim noSession As Object
Dim noDatabase As Object
Dim noDocument As Object
Dim noEmbedObject As Object
Dim noAttachment As Object
Dim stAttachment As String
Dim wsOrig As Worksheet
Dim wsTemp As Worksheet
Dim wsNew As Worksheet
Dim wsNew2 As Worksheet
Dim wbNew As Workbook
Dim rng As Range
Dim wsOrig2 As Worksheet
stAttachment = "D:\ABC123.xls"
vaRecipients = "me@me.com"
'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 noAttachment = noDocument.CreateRichTextItem("stAttachment")
Set noEmbedObject = noAttachment.EmbedObject(EMBED_ATTACHMENT, "", stAttachment)
'Add values to the created e-mail main properties.
With noDocument
.Form = "Memo"
.SendTo = vaRecipients
'.CopyTo = vaCopyTo
.subject = stSubject
.Body = vaMsg
.SaveMessageOnSend = True
.PostedDate = Now()
.send 0, vaRecipients
End With
'Delete the temporarily workbook.
Kill stAttachment
'Release objects from memory.
Set noEmbedObject = Nothing
Set noAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing
MsgBox "The e-mail has successfully been created and distributed", vbInformation
End Sub