I'm trying to e-mail via Lotus Notes from VB/VBA. What I have so far
works fine (see below) but I can't find any way to set either the to,
cc or bbc fields to more than one recipient.
Does anyone know a method of populating these fields with multiple
recipients in a format that Notes recognises without giving an address
book error? I think the problem might be centered around the fact that
Notes thinks these fields are a list, but I haven't been able to
determine the correct format.
This is what I've got so far :-
Sub SendEmail()
Dim objNotes As Object
Dim objNotesDB As Object
Dim objNotesMailDoc As Object
Dim objNotesBody As Object
Set objNotes = GetObject("", "Notes.Notessession")
Set objNotesDB = objNotes.getdatabase("", "")
Call objNotesDB.openmail
Set objNotesMailDoc = objNotesDB.CreateDocument
With objNotesMailDoc
'Insert message details
.Subject = "Subject"
.Body = "Message"
.SAVEMESSAGEONSEND = True
.Form = "Memo"
.SendTo = "reci...@domain.com"
.CopyTo = "ccrec...@domain.com"
.BlindCopyTo = "bccrec...@domain.com"
Call .Send(False)
End With
Set objNotes = Nothing
Set objNotesDB = Nothing
Set objNotesMailDoc = Nothing
Set objNotesBody = Nothing
Exit Sub
Thanks for any help you can give
Jeremy Tilson
London, UK
Sent via Deja.com
http://www.deja.com/
'use ReDim Preserve for flexibility
Dim sNames(2) As String
...
sNames(0) = "a...@acme.com"
sNames(1) = "b...@acme.com"
sNames(2) = "c...@acme.com"
...
With objNotesMailDoc
.AppendItemValue "SendTo", sNames
.Send False
End With
...
hth
DD
Jeremy Tilson wrote
One question: Does it have to be an array? Could you instead using
something like :-
With objNotesMailDoc
.AppendItemValue "SendTo", "a...@acme.com"
.AppendItemValue "SendTo", "b...@acme.com"
.AppendItemValue "SendTo", "c...@acme.com"
.Send False
End With
(forgive my ignorance with the Notes API, haven't been able to find out
much about it other than what's been posted in newsgroups -
Lotus 'support' site is useless!)
regards
Jeremy
In article <3A4095B2...@SPAMtomkins.co.uk>,
As mentioned though, you don't have to know the upper limit of the array
in advance, you can just initialise it then redeclare it every time you
want to add a new recipient with
ReDim Preserve sNames(Ubound(sNames) + 1)
sNames(Ubound(sNames)) = "nextre...@domain.com"
or something similar. Best bet for info on the API is the notes online
help.
Regards,
DD
Redim recipients(NumberOfRecipients - 1)
recipients(0) = "....."
recipients(0) = "....."
recioients(2) = "..."
etc.
.SendTo = recipients
Glenn S. Orenstein
Glenn Orenstein Consulting
(If replying by email, remove the "XXXX"s from the address)