Believe it or not, I had just returned to this issue this morning for a project. My attempts last summer failed, because I was passing the array improperly, like you, GComyn. My mistake was pretty dumb, though, I simply left out the array indicator when I defnined the subroutine.
This is a hybrid of several of the functions and routines previously posted to this thread. I simply took the components most applicable to my need at the time. I appreciate all of the hard work everyone has shared here and do not wish to indicate, at all, that this is mine. I merely wanted to show GComyn my array solution.
Sub SendLNEmail(strTo() As String, _ 'Pass recipients list as an array of string values
strCC As String, _
strBCC As String, _
strSubject As String, _
strMsg As String)
'***************************************************************************************************
'**Purpose: This code will send notes through Lotus Notes using VB/VBA OLE Automation
'**Arguments: Describe arguments and valid values.
' strTo INPUT: Pass the list of mail recipients as an array;
' strings are not valid, while they do not produce an error, only the first recipient will receive the note
' Format as fname.i.lname@domain
' strCC INPUT: Pass the list of carbon copy recipients as an array;
' strings are not valid, while they do not produce an error, only the first recipient will receive the note
' Format as fname.i.lname@domain
' strBCC INPUT: Pass the list of blind carbon copy recipients as an array;
' strings are not valid, while they do not produce an error, only the first recipient will receive the note
' Format as fname.i.lname@domain
' strSubject INPUT: Pass the subject line as a string
' strMsg INPUT: Pass the body of the message a string
'
'**Running App: Specifically tested in MS Access 97; should work from any application
'**Destination App: Lotus Notes Release 5.0.10
'**Dependencies: Reference to "Lotus Domino Objects" domobj.tlb
' Lotus Notes must be active and initialized
' **Code can be modified to activate and initialize Lotus Notes but requires the user's specific
' Notes mail server name and mail\USERNAME.nsf filename
'**Creation: 07/30/2003
'**Version Date: 05/03/2004
'**Version: 1.1
'**Author: Gabe Luebben
'**Notes: Additional useful documentation:
' Generally:
' Specifically:
' Copy of Lotus Notes redbook:
' **** DELETED FOR PRIVACY ****
'***************************************************************************************************
Dim lnSess As Object 'Lotus Notes session
Dim lnMail As Object 'Lotus Notes mail database
Dim lnDoc As Object 'Lotus Notes mail document object
Dim str_lnUserName As String 'Current user's Lotus Notes common name
Set lnSess = CreateObject("Notes.Notessession")
str_lnUserName = lnSess.CommonUserName
'Open the mail database.
' If the session has not yet been initialized by a user, the mail server name and the user's "mail\USERNAME.nsf" file must be passed
' Set lnMail = lnSess.GetDatabase("[MailServerName]/CHASE", "mail\[UsersNSFFileName].nsf")
Set lnMail = lnSess.GetDatabase("", str_lnUserName)
Debug.Print lnMail.FilePath
lnMail.Openmail
'Create a new mail document using the memo form
Set lnDoc = lnMail.CreateDocument
lnDoc.Form = "Memo"
'Populate the memo form and send
With lnDoc
.SendTo = strTo 'Pass multiple recipients as "name@domain, name2@domain, name3@domain"
.CopyTo = strCC 'Pass multiple recipients as "name@domain, name2@domain, name3@domain"
.BlindCopyTo = strBCC 'Pass multiple recipients as "name@domain, name2@domain, name3@domain"
.Subject = strSubject 'Currently a required value
.Body = strMsg 'Required value
.FROM = lnSess.CommonUserName 'It's not clear why some programmers used the user's name for the form
.SaveMessageOnSend = True 'Also populated in the .Send action
.Send True, strTo '.Send [SaveCopy] True or False, [Recipients]
End With
'Close all active objects
Set lnSess = Nothing
Set lnMail = Nothing
Set lnDoc = Nothing
End Sub