I have a VBA procedure that send email with Lotus Notes. It works perfectly until an upgrade to Lotus Notes 9.0 was done. Now, whenever the macro is run there is a run-time errors.
Codes:
Codes:
Code:
Sub SendEmailCandidat1() Dim stFileName As String
Dim stRecipients As String
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 stSubject As String
Dim vaMsg As Variant
Dim vaCopyTo As Variant
stRecipients = Range("email.employee").Value
stAttachment = ""
stSubject = Range("Email.subject1").Value
vaMsg = Range("Email.body1").Value
vaCopyTo = ""
'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 = stRecipients
.CopyTo = vaCopyTo
.Subject = stSubject
.Body = vaMsg
.SaveMessageOnSend = True
.PostedDate = Now()
.Send 0, stRecipients
End With
'Release objects from memory.
Set noEmbedObject = Nothing
Set noAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing
End Sub