W
wpshop
I am trying to send a report through Lotus Notes. Can I send it in
snp format or does it have to be pdf? I am using the following code but I
don't know how to reference an Access report? Do I have to export it first
and then send the email through the db? I know by EMBED code is wrong. I've
been trying to find a flow that will work but haven't had any luck so far. I
pulled this code through several online sources and am so close to finishing!
any help you can give would be appreciated.
Private Sub SendNotesMail_Click()
'Set up the objects required for Automation into lotus notes
Dim Form As String
Dim sendto As String
Dim Subject As String
Dim Attachement As String
Dim Recipient As String
Dim BodyText As String
Dim SaveIt As Boolean
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'The current userse notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (attachment)
'Start a notes session
Set Session = CreateObject("Lotus.NotesSession")
'Next line only works with 5.x and above. Replace password with your
password
Session.Initialize ("")
'Get the sessions username and then calculate the mail file name
'You may of may not need this as for MailDBName with some systems you
can pass an empty string or using above password you can use other mailboxes.
UserName = Session.UserName
Strt = Split(UserName, "=")(1)
Strt = Split(Strt, "/")(0)
WordArray = Left$(Strt, 1) & Right(Strt, (Len(Strt) - InStr(1, Strt, "
")))
MailDbName = "mail/" & WordArray
'Open the mail dtabase in notes
Set Maildb = Session.GETDATABASE("ABCD_LN01", MailDbName)
'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
Call MailDoc.REPLACEITEMVALUE("Form", "Memo")
Call MailDoc.REPLACEITEMVALUE("SendTo", "(e-mail address removed)")
Call MailDoc.REPLACEITEMVALUE("Subject", "HOT! TEST SUBJECT")
Set Body = MailDoc.CREATERICHTEXTITEM("Body")
Call Body.APPENDTEXT("Body text here")
Call Body.ADDNEWLINE(2)
Call Body.EMBEDOBJECT(1454, "", , "Monthly Report")
MailDoc.SAVEMESSAGEONSEND = True
'Send the document
Call MailDoc.REPLACEITEMVALUE("PostedDate", Now())
Call MailDoc.SEND(False)
'Clean up
Set Maildb = Nothing
Set MailDoc = Nothing
Set Body = Nothing
Set Session = Nothing
snp format or does it have to be pdf? I am using the following code but I
don't know how to reference an Access report? Do I have to export it first
and then send the email through the db? I know by EMBED code is wrong. I've
been trying to find a flow that will work but haven't had any luck so far. I
pulled this code through several online sources and am so close to finishing!
any help you can give would be appreciated.
Private Sub SendNotesMail_Click()
'Set up the objects required for Automation into lotus notes
Dim Form As String
Dim sendto As String
Dim Subject As String
Dim Attachement As String
Dim Recipient As String
Dim BodyText As String
Dim SaveIt As Boolean
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'The current userse notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (attachment)
'Start a notes session
Set Session = CreateObject("Lotus.NotesSession")
'Next line only works with 5.x and above. Replace password with your
password
Session.Initialize ("")
'Get the sessions username and then calculate the mail file name
'You may of may not need this as for MailDBName with some systems you
can pass an empty string or using above password you can use other mailboxes.
UserName = Session.UserName
Strt = Split(UserName, "=")(1)
Strt = Split(Strt, "/")(0)
WordArray = Left$(Strt, 1) & Right(Strt, (Len(Strt) - InStr(1, Strt, "
")))
MailDbName = "mail/" & WordArray
'Open the mail dtabase in notes
Set Maildb = Session.GETDATABASE("ABCD_LN01", MailDbName)
'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
Call MailDoc.REPLACEITEMVALUE("Form", "Memo")
Call MailDoc.REPLACEITEMVALUE("SendTo", "(e-mail address removed)")
Call MailDoc.REPLACEITEMVALUE("Subject", "HOT! TEST SUBJECT")
Set Body = MailDoc.CREATERICHTEXTITEM("Body")
Call Body.APPENDTEXT("Body text here")
Call Body.ADDNEWLINE(2)
Call Body.EMBEDOBJECT(1454, "", , "Monthly Report")
MailDoc.SAVEMESSAGEONSEND = True
'Send the document
Call MailDoc.REPLACEITEMVALUE("PostedDate", Now())
Call MailDoc.SEND(False)
'Clean up
Set Maildb = Nothing
Set MailDoc = Nothing
Set Body = Nothing
Set Session = Nothing