I don't know much about Lotus Notes or automating it, but you don't Set Session to anything. You'll need to do that before your Set Maildb (first command) line.
Asa -----Original Message----- From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of NJIBA Sent: Thursday, December 22, 2011 1:22 PM To: MS EXCEL AND VBA MACROS Subject: $$Excel-Macros$$ Macro that sends email with an attachment of current excel doc in lotus - Help! So I used the VB below and I fell in an abyss. I know it's not working because I do not get an email but I dont get an error message either. Any suggestion will be welcome. Dim Maildb As Object Dim MailDoc As Object Dim Body As Object Dim Session As Object 'Open the Mail Database of your Lotus Notes Set Maildb = Session.GETDATABASE("", "C:\Documents and Settings \USER ID\My Documents\Notes\bookmark.nsf") If Not Maildb.IsOpen = True Then Call Maildb.Open 'Create the Mail Document Set MailDoc = Maildb.CREATEDOCUMENT Call MailDoc.REPLACEITEMVALUE("Form", "New Message") 'Set the Recipient of the mail Call MailDoc.REPLACEITEMVALUE("SendTo", "jtmv...@comerica.com") 'Set subject of the mail Call MailDoc.REPLACEITEMVALUE("Subject", "ORE Entry") 'Create and set the Body content of the mail Set Body = MailDoc.CREATERICHTEXTITEM("Body") Call Body.APPENDTEXT("Body text here") 'Example to create an attachment (optional) Call Body.ADDNEWLINE(2) Call Body.EMBEDOBJECT(1454, "", "C:\Documents and Settings \USER ID\Desktop\ORE Improvements\NAME OF FILE.xlsm", "Attachment") 'Example to save the message (optional) in Sent items MailDoc.SAVEMESSAGEONSEND = True 'Send the document 'Gets the mail to appear in the Sent items folder Call MailDoc.REPLACEITEMVALUE("PostedDate", Now()) Call MailDoc.SEND(False) 'Clean Up the Object variables - Recover memory Set Maildb = Nothing Set MailDoc = Nothing Set Body = Nothing Set Session = Nothing Exit Sub -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ---------------------------------------------------------------------------- -------------------------- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com