C
Chad
This code I found somewhere on the net and it works a treat for sending
one attachment to multiple recipients within a Lotus Notes environment.
It would be more practical to have the email names in Col A and have it
send more than one attachment with the corresponding file name and path
in Col B. I have to send out about 10 different attachments. Is this
possible with an array of some sort? Any help would be most
appreciated as I am all searched out and I usually find what I am
after.
Thanks
Chad
Sub SendLotusNote()
' be sure to reference the Lotus Domino Objects, domobj.tlb
Dim objNotesSession As Object
Dim objNotesDatabase As Object
Dim objNotesDocument As Object
Dim objAttachment As Object
Dim objRichText As Object
Dim FullPath As String
Dim FileName As String
Dim Msg As String
Const EMBED_ATTACHMENT = 1454
Set objNotesSession = CreateObject("Notes.Notessession")
Set objNotesDatabase = objNotesSession.GetDatabase("", "")
Call objNotesDatabase.OpenMail 'default mail database
If objNotesDatabase.IsOpen = False Then
MsgBox "Cannot connect to Lotus Notes."
Exit Sub
End If
Set objNotesDocument = objNotesDatabase.CreateDocument
Call objNotesDocument.ReplaceItemValue("Form", "Memo")
ActiveWorkbook.Save
FullPath = Range("B1").Value ' file to send lives here
' assemble message
Set objRichText = objNotesDocument.CreateRichTextItem("Body")
Set objAttachment = objRichText.EmbedObject(EMBED_ATTACHMENT, "",
FullPath)
Msg = "Lotus Note sent from " & objNotesSession.CommonUserName
With objNotesDocument
.Subject = ""
.body = Msg
.SendTo = Array("(e-mail address removed)", "(e-mail address removed)",
"(e-mail address removed)")
.SaveMessageOnSend = True ' save in Sent folder
.Send (False)
End With
Set objNotesSession = Nothing
Set objNotesDatabase = Nothing
Set objNotesDocument = Nothing
Set objAttachment = Nothing
Set objRichText = Nothing
End Sub
one attachment to multiple recipients within a Lotus Notes environment.
It would be more practical to have the email names in Col A and have it
send more than one attachment with the corresponding file name and path
in Col B. I have to send out about 10 different attachments. Is this
possible with an array of some sort? Any help would be most
appreciated as I am all searched out and I usually find what I am
after.
Thanks
Chad
Sub SendLotusNote()
' be sure to reference the Lotus Domino Objects, domobj.tlb
Dim objNotesSession As Object
Dim objNotesDatabase As Object
Dim objNotesDocument As Object
Dim objAttachment As Object
Dim objRichText As Object
Dim FullPath As String
Dim FileName As String
Dim Msg As String
Const EMBED_ATTACHMENT = 1454
Set objNotesSession = CreateObject("Notes.Notessession")
Set objNotesDatabase = objNotesSession.GetDatabase("", "")
Call objNotesDatabase.OpenMail 'default mail database
If objNotesDatabase.IsOpen = False Then
MsgBox "Cannot connect to Lotus Notes."
Exit Sub
End If
Set objNotesDocument = objNotesDatabase.CreateDocument
Call objNotesDocument.ReplaceItemValue("Form", "Memo")
ActiveWorkbook.Save
FullPath = Range("B1").Value ' file to send lives here
' assemble message
Set objRichText = objNotesDocument.CreateRichTextItem("Body")
Set objAttachment = objRichText.EmbedObject(EMBED_ATTACHMENT, "",
FullPath)
Msg = "Lotus Note sent from " & objNotesSession.CommonUserName
With objNotesDocument
.Subject = ""
.body = Msg
.SendTo = Array("(e-mail address removed)", "(e-mail address removed)",
"(e-mail address removed)")
.SaveMessageOnSend = True ' save in Sent folder
.Send (False)
End With
Set objNotesSession = Nothing
Set objNotesDatabase = Nothing
Set objNotesDocument = Nothing
Set objAttachment = Nothing
Set objRichText = Nothing
End Sub