Within our corporate Microsoft Exchange, I'm trying to add a recipient to one of our Distribution lists. The code I've listed below allows me to view the members of the selected distribution list. I cannot figure out how to add a recipient to the distribution list.
Code:
Dim olApp As Outlook.Application
Dim objNS As Outlook.Namespace
Dim objAddrList As Outlook.AddressList
Dim olDistListItem As Object
Dim objAddrEntry As Outlook.AddressEntry
On Error GoTo ErrorHandler
Set olApp = GetObject(, "Outlook.Application")
Set objNS = olApp.GetNamespace("MAPI")
Set objAddrList = objNS.Session.AddressLists("Global Address List")
DistName = "/CHI ITS Directors All"
Set olDistListItem = objAddrList.AddressEntries(DistName)
MsgBox olDistListItem.Members.Count
For i = 1 To olDistListItem.Members.Count
Set objAddrEntry = olDistListItem.Members.Item(i)
MsgBox objAddrEntry.Name
Next
Set objAddrEntry = Nothing
Set olDistListItem = Nothing
Set objAddrList = Nothing
Set objNS = Nothing
Set olApp = Nothing
Thanks in advance!!