VBA & Macro Problems

Can Excel VBA Search Microsoft Teams for a Person's Email?

Rana GarciaRana Garcia Oct 23, 2026 869 views

Question details

The user wants to enter a name in an Excel worksheet and automatically search Microsoft Teams to retrieve the corresponding email address.

Can Excel VBA Search Microsoft Teams for a Person?
Product
Microsoft Excel, Microsoft Teams
Device & OS
not provided
Scenario
Trying to automate the retrieval of a person's email address from Microsoft Teams based on a name entered into an Excel worksheet.
Observed behavior
Excel's native functions like XLOOKUP and standard VBA cannot directly communicate with or search Microsoft Teams.
Before you start

Searching Microsoft Teams directly from Excel requires advanced cloud integrations like Microsoft Graph API or Power Automate, as standard VBA or built-in formulas cannot query Teams natively.

Solution 1Recommended

Use Power Automate to Connect Excel and Office 365 Users

Since standard VBA cannot directly query Teams, Power Automate provides a seamless, low-code way to connect Excel data with Microsoft 365 user directories to retrieve emails.

Power Automate runs in the cloud, meaning this solution will work across Windows, Mac, and mobile devices, bypassing the limitations of local VBA macros.

1
Create an Excel Table

Ensure your Excel file is saved in OneDrive or SharePoint. Format the list of names in your worksheet as a formal Excel Table.

2
Set Up a Power Automate Flow

Log into Power Automate online and create a new flow. You can use an 'Instant cloud flow' triggered by a selected row in your Excel table.

3
Add a 'Search for users' Action

Add a new step and choose the 'Search for users (V2)' action under the Office 365 Users connector. Map the search term to the Name column from your Excel table.

4
Update the Excel Row

Add an 'Update a row' action for Excel Online. Configure it to write the retrieved 'Mail' dynamic content back into the designated email column in your spreadsheet.

Use Power Automate to Connect Excel and Office 365 Users
Cross-Platform Compatibility: Because Power Automate is cloud-based, the automation will successfully trigger and update the workbook whether you are on a desktop, Android, or iPhone.
Free Microsoft Office alternative

Looking for a powerful, free spreadsheet editor?

While querying Microsoft Teams requires complex API integrations, for your everyday data analysis and macro needs, WPS Office offers a lightweight, highly compatible, and free alternative to Microsoft Office. Enjoy seamless formatting and comprehensive formula support without the subscription fees.

  1. 1. Download WPS Office: Visit the official WPS website and download the free installation package for your operating system.
  2. 2. Install the Application: Run the installer and follow the on-screen prompts to set up WPS Office on your device.
  3. 3. Open Your Spreadsheets: Launch WPS Spreadsheets and open your existing .xlsx files to start working immediately with full compatibility.
Free and fully compatible with Microsoft Excel (.xlsx) formatsSupports advanced formulas like XLOOKUP and complex data analysisLightweight application that runs smoothly on Windows, Mac, and LinuxIncludes an easy-to-use interface identical to what you are used to
microsoft office alternative - wps office

Frequently Asked Questions

Can I use XLOOKUP to search data across different applications?

No, XLOOKUP is strictly designed to search for data within Excel workbooks. It cannot communicate with external applications like Microsoft Teams, Outlook, or external databases directly without a backend data connection.

Is there any built-in Excel function to get a user's email from Teams?

There is no native Excel formula that fetches user emails from Teams. However, if your organization uses Microsoft 365, you may be able to use the 'Organization' linked data types to pull employee details directly into cells.

Why doesn't standard VBA work with Microsoft Teams?

VBA is a legacy automation language designed to interact with desktop Office applications using local COM objects. Microsoft Teams is a modern cloud-based application without a local COM interface, meaning integrations require REST APIs like Microsoft Graph.

What is the best way to make this search work on mobile devices?

Since VBA macros do not run on Excel for mobile, the best approach is to build a Power App or use a cloud-based Power Automate flow. This ensures the data lookup runs on a remote server and works identically across Windows, Android, and iOS devices.