CreateItem help

  • Thread starter Thread starter CK
  • Start date Start date
C

CK

Good Morning All,

Quick question. I have an ADO recordset of email addresses. I need to
create an email to these people and I want them to be in the BCC field.
What is the beat approach to this? I had something like

Function NewMail(r as ADO.Recordset)
dim mail as New Outlook.MailItem
set mail = Application.CreateItem(olMailItem)

'this is where I get stuck I would like to pass this function a recordset
and loop through it, and add each 'email address to the BCC field, then
display the item. Any suggestions?

End Function


Any advice is always appreciated. Thanks in Advance.

Chris
 
Add each recipient and set it to Bcc. Note that this will trigger a security prompt:

Set recip = mail.Recipients("<some name or address>")
If recip.Resolved Then
recip.Type = olBcc
End If

Alternatively, iterate your recordset and build a string of all the addresses, separated by semicolons, then set the Bcc property. This will not trigger a security prompt, but if any address is malformed, the message won't send:

mail.Bcc = "<your delimited list of addresses>"

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.outlook.program_vba

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top