How to Handle Multiple Outlook Global Address List Results in VBA
Question details
The user needs to handle search scenarios where an Outlook Global Address List (GAL) query returns multiple results for a single username using VBA.

- Product
- Microsoft Outlook / VBA
- Device & OS
- not provided
- Scenario
- Writing a VBA macro to search the Global Address List and accurately select a specific user when multiple AddressEntry objects match one username.
- Observed behavior
- Using the AddressEntries.Find method fails with an "Object doesn't support this property or method" error when attempting to use the .Count property to evaluate the number of returned matches.
Ensure that your Office application has developer tools enabled and that Outlook is actively connected to the Exchange server to successfully access the Global Address List.
Iterate Through AddressEntries to Match Reliable Properties
Bypass the unsupported Count property by looping through the AddressEntries collection and conditionally matching explicit properties.
When searching the Outlook Global Address List, a single username might yield multiple AddressEntry objects. Because the AddressEntries.Find method does not return a standard collection that supports the Count property, attempting to count the results will throw an error.
To resolve this, you should retrieve the full AddressEntries collection for the GAL and iterate through each entry using a For Each loop. During iteration, evaluate reliable properties—such as the explicit display name, email address, or unique alias—to pinpoint the exact match you need.
In your VBA editor, set a reference to the Outlook Application object and instantiate the `Session.AddressLists("Global Address List")` object to access the directory.
Create a `For Each` loop to iterate over the `AddressEntries` collection directly instead of using the `.Find` and `.Count` methods.
Inside the loop, use an `If` statement to compare `AddressEntry.Name` or `AddressEntry.Address` against your target criteria (for instance, distinguishing between multiple variations of a name like 'saket roy-yy' and 'saket roy-xx').
Once the correct match evaluates as true, assign the target `AddressEntry` to your object variable and use `Exit For` to stop the loop efficiently.

Looking for a Fast and Reliable Office Alternative?
While troubleshooting VBA scripts specific to Microsoft Outlook, consider WPS Office for your core document, spreadsheet, and presentation needs. It offers exceptional format compatibility and robust macro support in a lightweight package.

Frequently Asked Questions
Why do I get an 'Object doesn't support this property or method' error when using Count on AddressEntries?
The `AddressEntries.Find` method does not return a standard collection object that supports the `.Count` property. You must loop through the `AddressEntries` collection directly instead of trying to count the results returned by `.Find`.
How can I select a specific GAL entry if a user has multiple profiles?
You should iterate through the collection and check unique attributes such as the alias, specific email address, or precise display name format (e.g., 'name-xx' vs 'name-yy') to conditionally select the exact match.
Can I rely on the position or index of the AddressEntry in the GAL?
It is highly recommended not to select an entry solely by its index position. The ordering of the Global Address List is not strictly guaranteed and can change as directories update, which may lead to incorrect selections.




