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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generating outlook distribution lists through A2k

Status
Not open for further replies.

Kebabmeister

Programmer
Apr 22, 2003
94
0
0
GB
Basically, does anyone know how to do it?

I want to check for a distribution list on db load and generate one where not present.

I'm currently using automation to send mails and trawling through help (sic) I have not been able to find.
 
I found this which might help

Public Function GetContact()
Dim olApp As Outlook.Application
Dim contacts As Outlook.MAPIFolder
Dim listContact As Outlook.Recipient
Dim distList As Outlook.DistListItem
Dim i As Integer

Set olApp = New Outlook.Application
Set contacts = olApp.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts)
Set distList = contacts.Items("Rugby Trip")

For i = 1 To distList.MemberCount
Set listContact = distList.GetMember(i)
Debug.Print listContact.Address
Next

Set listContact = Nothing
Set distList = Nothing
Set contacts = Nothing
Set olApp = Nothing


End Function

Then if it does not exist create the object.

Regs
Peachmelba
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top