[AccessD] VB module to send mail in Lotus Notes

Todd Buttrey todd_5036 at msn.com
Thu May 8 16:35:37 CDT 2003


Sounds like you are trying to instantiate an object that normally resides on 
the client but now is residing on the server.  Is this true?


----Original Message Follows----
From: "Barbara Ryan" <BarbaraRyan at cox.net>
Reply-To: accessd at databaseadvisors.com
To: "Access List" <AccessD at databaseadvisors.com>
Subject: [AccessD] VB module to send mail in Lotus Notes
Date: Thu, 8 May 2003 17:29:05 -0400

I have a VB module (in an Access 97 database) that uses Lotus Notes to send 
mail.  It has worked fine at several client sites, but is encountering 
problems at a new site.  The error received is "429: ActiveX component can't 
create object".  It apparently is erroring on the statement "Set Session = 
CreateObject("Notes.NotesSession")". (see all code below)

The only difference (that I am aware of) is that this client uses Lotus 
Notes 5.0 10 and the Lotus Notes client is installed on a server.

This is really more of a Lotus Notes question, but I have not yet been able 
to find a forum where I can ask this question.

Any thoughts/suggestions?

Thanks,
Barb Ryan

Private Sub SendNotesMail()
     On Error GoTo Err_Handler

     'Set up the objects required for Automation into lotus notes
     Dim Maildb As Object 'The mail database
     Dim UserName As String 'The current users notes name
     Dim MailDbName As String 'THe current users 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 session to notes
     Set Session = CreateObject("Notes.NotesSession")

     'Get the sessions username and then calculate the mail file name
     UserName = Session.UserName
     MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - 
InStr(1, UserName, " "))) & ".nsf"

     'Open the mail database in notes
     Set Maildb = Session.GETDATABASE("", MailDbName)
      If Maildb.isOpen = True Then
           'Already open for mail
      Else
          Maildb.OPENMAIL
      End If

     'Set up the new mail document
     Set MailDoc = Maildb.CREATEDOCUMENT
     MailDoc.Form = "Memo"
     MailDoc.sendto = strRecipient
     MailDoc.Subject = strSubject

     If strLongSnaphotName > "" Then
         strbody = "This document, and any attachments therein, contains 
proprietary and confidential information that may not be disclosed without 
the prior written permission of Huntsman Corporation. Unauthorized use or 
misuse of this information and its contents is strictly prohibited." & 
vbCrLf & vbCrLf & "The attached file must be viewed using Microsoft Snapshot 
Viewer, which is a free download at 
http://office.microsoft.com/downloads/9798/snpvw80.aspx" & vbCrLf & vbCrLf & 
"Huntsman reference: " & strLongSnaphotName
     Else
         strbody = "This document, and any attachments therein, contains 
proprietary and confidential information that may not be disclosed without 
the prior written permission of Huntsman Corporation. Unauthorized use or 
misuse of this information and its contents is strictly prohibited." & 
vbCrLf & vbCrLf & "The attached file must be viewed using Microsoft Snapshot 
Viewer, which is a free download at 
http://office.microsoft.com/downloads/9798/snpvw80.aspx"
     End If

     MailDoc.Body = strbody
     MailDoc.SAVEMESSAGEONSEND = True

     'Set up the embedded object and attachment and attach it
     Set AttachME = MailDoc.createrichtextitem("attachment")
     Set EmbedObj = AttachME.embedObject(1454, "", strAttachment)

     'Send the document
     MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items 
folder
     MailDoc.SEND 0, strRecipient

     'Clean Up
     Set Maildb = Nothing
     Set MailDoc = Nothing
     Set AttachME = Nothing
     Set Session = Nothing
     Set EmbedObj = Nothing

Exit_SendNotesMail:
     Exit Sub

Err_Handler:
     blnError = True
     MsgBox Err.Number & ":" & Err.Description
     Resume Exit_SendNotesMail

End Sub



_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus



More information about the AccessD mailing list