Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a distribution list without creating contacts

Status
Not open for further replies.

seaport

MIS
Jan 5, 2000
923
US
With Outlook 2000/2003, I can manually create a distribution list, which contains several email addresses that are not related to any contacts in the Contacts folder.

However, I could not figure out how to do that using VBA. What I am trying to do is to programmingly create a distribution list, which contains email addresses list generated from an Access database.

That's what I got so far.
Code:
Set myOlApp = CreateObject("Outlook.Application")
Set myDistList= myOlApp.CreateItem(olDistributionListItem)
myDistList.DLName = "Test"
Set myTempItem = myOlApp.CreateItem(olMailItem)
Set myRecipients = myTempItem.Recipients
'Here is my problem. When I tried to add a Recipient object
'to the Recipients collection, I could not create a
'Recipient object, which just contains a name and an address  
'and is not related to any contact in the Contacts folder.
myDistList.AddMembers myRecipients
myDistList.Display

Any suggestions?

Thanks in advance.

Seaport
 
Here are some further explanations.

In Outlook 2003, when creating a new distribution list, I can use either "Select Members" button or "Add New" button. I can use VBA to automate "Select Members" process, but I cannot automate "Add New" process. ("Add New" means adding a person who is not in the Contacts folder).

Seaport
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top