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 bkrike 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 in Outlook 1

Status
Not open for further replies.

gaelin

Technical User
Jan 13, 2004
35
US
I have a one-time requirement to create a distribution list in Outlook. I have DBF table that contracts the name and email address. I want to take that data an insert into the distribution list. I'm familiar with Automation, but would gladly accept some code already done.
 
My experience has been that to put an item in an Outlook distribution list by automation, it has to exist in the Contacts folder. (I haven't tested with Outlook 2003, though, and can't remember if I tested in Outlook XP.)

Once you've created the contact items, creating a distribution list is easy:

Code:
* Assume oDLFolder points to a folder containing
* the contacts to be added to the distribution list

oDLContacts = oDLFolder.Items
oContact = oDLContacts.GetFirst

oDL = oOutlook.CreateItem(7)
oDL.Subject = "Name of distribution list"

oJunk = oOutlook.CreateItem(0)
oRecip = oJunk.Recipients
	
FOR EACH oContact IN oDLContacts
   oRecip.Add(oContact.Email1Address)
   oContact=oDLContacts.GetNext
ENDFOR 
	
oDL.AddMembers(oRecip)
oDL.Save

Hope this helps.

Tamar
 
Tamar,

I pretty sure I understand, load the table into contacts then into the distribution list. I'll let you know how I fare.

Ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top