Sending email to distribution list/group via VBA for Outlook

mercredi 11 mars 2015

Below is the code that i'm going to be using to send info to all our clients. When I have a few email address in the recipients.add part, the email shows all the addresses. Now I have a group of 100 addresses and the email appears at the end of the code with the word bids in the bcc, not the group. How do I get the group to appear instead of just the word? I've tried taking the quotes away from the word bids, but that gives me an error.

Thanks in advance.



Code:

Public Function emailbids()

Dim oOutlook As Outlook.Application

Dim oEmailItem As MailItem



On Error Resume Next

Set oOutlook = GetObject(, "Outlook.Application")

If oOutlook Is Nothing Then Set oOutlook = CreateObject("Outlook.Application")



Set oEmailItem = oOutlook.CreateItem(olMailItem)



With oEmailItem

.HTMLBody = "This is only a test."

.recipients.Add("bids").Type = 3

.Subject = "subject goes here"

'.Send 'if you want to send it directly without displaying on screen

.Display

End With



Set oEmailItem = Nothing

Set oOutlook = Nothing

End Function

Sending email to distribution list/group via VBA for Outlook

0 commentaires:

Enregistrer un commentaire

Labels