Results 1 to 4 of 4
  1. #1
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398

    Using the Outlook object, adding a recipient to a Distribution List

    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!!

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848

  3. #3
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    Thank you for the reply.

    Of the links you provided, I previously looked at the first one. This one creates a new distribution list. I can't figure out the changes to use an existing distribution list.

    Any further assistance would be greatly appreciated.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Try this, read the comments because it seems to work after some mod??
    via Google

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Word recipient list empty with Access query.
    By wackywoo105 in forum Queries
    Replies: 7
    Last Post: 09-02-2014, 09:58 AM
  2. Object Variable Not Set when Outlook is running
    By chris.williams in forum Programming
    Replies: 3
    Last Post: 10-03-2012, 02:33 PM
  3. Outlook Object Model question - automation
    By yeah in forum Programming
    Replies: 1
    Last Post: 11-23-2010, 02:05 PM
  4. Report Distribution List
    By mvuhu_accessforum in forum Forms
    Replies: 1
    Last Post: 10-18-2010, 11:18 AM
  5. Replies: 2
    Last Post: 02-04-2010, 10:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums