+ Reply to Thread
Results 1 to 3 of 3

Extract members of a Particular Distribution list from outlook to excel using vba

  1. #1
    Registered User
    Join Date
    03-27-2015
    Location
    USA
    MS-Off Ver
    2010
    Posts
    53

    Extract members of a Particular Distribution list from outlook to excel using vba

    hi,

    iam trying to extract the members of a particular Distribution list from the Global Address list from outlook to excel.

    this is the code i have tried so far, iam able to pull all the distribution lists but not a specific list...

    Can someone help me with the syntax iam missing?? having trouble with lines in BOLD


    sDLName = " Managers" 'Name of the distribution List
    Set appOL = CreateObject("Outlook.Application")
    Set oGAL = appOL.GetNameSpace("MAPI").AddressLists("All Distribution Lists").AddressEntries
    Set oDL = oGAL(sDLName).Item

    For i = 1 To oDL.Members.Count
    Set oContact = oDL.Members.Item(i)
    If oContact.AddressEntryUserType = 0 Then
    Set oUser = oContact.GetExchangeUser
    If Len(oUser.lastname) > 0 Then
    UserIndex = UserIndex + 1
    arrUsers(UserIndex, 1) = oUser.OfficeLocation
    arrUsers(UserIndex, 2) = oUser.PrimarySMTPAddress

    End If
    End If
    Next i

    appOL.Quit


    Merge the two lines highlighted in bold to one as below:
    Set oGAL = appOL.GetNameSpace("MAPI").AddressLists("All Distribution Lists").AddressEntries.Item(sDLName)
    Last edited by NeoDasari; 04-14-2015 at 12:50 PM. Reason: found the solution

  2. #2
    Valued Forum Contributor
    Join Date
    05-07-2014
    Location
    India
    MS-Off Ver
    MS Office 365
    Posts
    313

    Re: Extract members of a Particular Distribution list from outlook to excel using vba

    Hi,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between
    Please Login or Register  to view this content.
    tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    Thanks
    Nisha

  3. #3
    Registered User
    Join Date
    09-01-2014
    Location
    Buenos Aires
    MS-Off Ver
    2013
    Posts
    1

    Re: Extract members of a Particular Distribution list from outlook to excel using vba

    Hi,
    Was this solved? I'm looking for a way to extract the members of about 200 different distribution lists.

    Thanks,
    Luis

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA help to send pdf attachments via Outlook to Excel distribution list
    By jackreacher39uk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-21-2013, 08:14 AM
  2. Create Outlook Distribution List
    By laprofe in forum Excel General
    Replies: 0
    Last Post: 08-13-2006, 04:45 PM
  3. Creating Outlook Distribution List
    By Ed Kura in forum Excel General
    Replies: 2
    Last Post: 07-19-2005, 09:05 AM
  4. Replies: 2
    Last Post: 06-24-2005, 12:05 AM
  5. Is it possible to create distribution list for Outlook?
    By John Elink in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-07-2005, 05:07 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1