My goal is to create VBA code that adds a new member to an Exchange Distribution List.


I've run into a number of hurdles when trying to figure this out.


1. I have this code:


'==============
Dim olEntry As Outlook.AddressEntry
Dim olEntryAdd As Outlook.AddressEntry
Dim olDL As Outlook.ExchangeDistributionList


Set olEntry = Application.Session.GetGlobalAddressList.AddressEntries("my address list")
Set olDL = olEntry.GetExchangeDistributionList

Debug.Print olDL
Debug.Print
Debug.Print "Members:"
For i = 1 To olDL.Members.Count
Debug.Print olDL.Members.Item(i), olEntry.Members.Item(i).GetExchangeUser.PrimarySmtpAddress
Next i


Set olEntryAdd = olEntry.Members.Add("SMTP", "John Doe", "myEmailAddress")
'==============


This correctly prints out each member in the list.


However, the final line results in this error: The bookmark is not valid.


Can someone tell me the correct syntax to add a new member to this list?


2. Outlook Object Model


Refer to documentation on the exchangedistributionlist object.


The remarks discuss the AddressEntry.Members property.


However, looking at the AddressEntry object, there is no mention of a Members property.


Can someone point me to some documentation on this property?




Thanks!
Dennis