'Addresses in distribution list in the Global Address Book of a non-default account
I am using MS Office 2010.
My Outlook is configured with two email IDs. One is client another one is company.
I have a code in Excel to check an Outlook distribution list and import member details into Excel.
I am able to import the details from a distribution list in the GAL for a default mail ID.
I am unable to select the distribution list in the GAL for other email.
It searches for the DL in the default account's GAL and selects the wrong name.
Dim olApp As Outlook.Application
Dim olNS As Outlook.Namespace
Dim olAL As Outlook.AddressList
Dim olEntry As Outlook.AddressEntry
Dim olMember As Outlook.AddressEntry
Dim lMemberCount As Long
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set olAL = olNS.AddressLists("Global Address List")
Set objMail = olApp.CreateItem(olMailItem)
' enter the list name
Set olEntry = olAL.AddressEntries(".DL IS Support")
' get count of dist list members
lMemberCount = olEntry.Members.Count
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
