M
Mark Kovach
I am using the code below to send e-mails from Access
through Lotus Notes. This code works great to send an e-
mail and attach a file to it. My problem is that I need
to send the e-mail and attach a report or query to it.
Everything I have found on the web only talks about
attaching a file from outside of Access to the e-mail.
How do I attach a report or query to the e-mail that I am
sending??
Thanks very much for your help.
Sub TestEmail()
Dim objNotesSession As Object
Dim objNotesDatabase As Object
Dim objNotesDocument As Object
Dim strText As String
Dim strMsg As String
Dim strRecipient As String
Dim objAttach As Object
Dim objEmbed As Object
Dim arrRecipient(20) As String
Set objNotesSession = CreateObject("Notes.Notessession")
Set objNotesDatabase = objNotesSession.GETDATABASE("", "")
Call objNotesDatabase.OPENMAIL
Set objNotesDocument = objNotesDatabase.CREATEDOCUMENT
strText = "Body text of message"
arrRecipient(0) = "(e-mail address removed)"
arrRecipient(1) = "(e-mail address removed)"
Call objNotesDocument.REPLACEITEMVALUE("SendTo",
arrRecipient)
Call objNotesDocument.REPLACEITEMVALUE("Subject", "Access
Message")
Call objNotesDocument.REPLACEITEMVALUE("Body", strText)
Set objAttach = objNotesDocument.CREATERICHTEXTITEM
("Attachment")
Set objEmbed = objAttach.EMBEDOBJECT
(1454, "", "c:\cash.bat", "Attachment")
Call objNotesDocument.SEND(False)
Set objNotesSession = Nothing
End Sub
through Lotus Notes. This code works great to send an e-
mail and attach a file to it. My problem is that I need
to send the e-mail and attach a report or query to it.
Everything I have found on the web only talks about
attaching a file from outside of Access to the e-mail.
How do I attach a report or query to the e-mail that I am
sending??
Thanks very much for your help.
Sub TestEmail()
Dim objNotesSession As Object
Dim objNotesDatabase As Object
Dim objNotesDocument As Object
Dim strText As String
Dim strMsg As String
Dim strRecipient As String
Dim objAttach As Object
Dim objEmbed As Object
Dim arrRecipient(20) As String
Set objNotesSession = CreateObject("Notes.Notessession")
Set objNotesDatabase = objNotesSession.GETDATABASE("", "")
Call objNotesDatabase.OPENMAIL
Set objNotesDocument = objNotesDatabase.CREATEDOCUMENT
strText = "Body text of message"
arrRecipient(0) = "(e-mail address removed)"
arrRecipient(1) = "(e-mail address removed)"
Call objNotesDocument.REPLACEITEMVALUE("SendTo",
arrRecipient)
Call objNotesDocument.REPLACEITEMVALUE("Subject", "Access
Message")
Call objNotesDocument.REPLACEITEMVALUE("Body", strText)
Set objAttach = objNotesDocument.CREATERICHTEXTITEM
("Attachment")
Set objEmbed = objAttach.EMBEDOBJECT
(1454, "", "c:\cash.bat", "Attachment")
Call objNotesDocument.SEND(False)
Set objNotesSession = Nothing
End Sub