VBA & Macro Problems

Why VBA Code Disappears in Microsoft Teams and How to Open .xlsm Macros

Elise WilliamsElise Williams Nov 13, 2026 869 views

Question details

The user needs to understand why VBA code in an Excel workbook is not visible or does not run after opening or uploading the file through Microsoft Teams.

Product
Microsoft Excel workbook with VBA macros in Microsoft Teams
Device & OS
not provided
Scenario
A user opens or uploads a macro-enabled Excel workbook in Microsoft Teams and expects the VBA code and macros to remain available.
Observed behavior
The workbook appears without its macros or does not run VBA code because Teams opens it in Excel for the web, which does not support running or editing VBA macros.
Before you start

Before following the steps, check whether the file is stored on the Teams Files tab or shared in a chat. Download the original workbook to your computer and verify that its extension is .xlsm, because an .xlsx version cannot contain VBA macros.

Solution 1Recommended

Download the workbook from Teams and open it in desktop Excel

Use this solution when you need to view, edit, or run VBA macros that disappear in the Teams web viewer.

Microsoft Teams opens Excel files with Excel for the web by default. Excel for the web can store some macro-enabled files, but it cannot run or edit VBA code, so the macros are not available until the file is opened in the desktop version of Excel.

1
Locate the file in Microsoft Teams

Open the Teams channel or chat where the Excel workbook was shared, and go to the Files tab or the shared message that contains the attachment.

2
Download the workbook

Select the workbook, click More options (⋯), and choose Download. Save the file to a local folder on your computer.

3
Open the file in desktop Excel

Right-click the downloaded file and select Open with > Excel, or open Excel and use File > Open to browse to the file.

4
Confirm the file is macro-enabled

In Excel, click File > Save As, confirm the file type is Excel Macro-Enabled Workbook (.xlsm), and save it if needed.

Macros are available in desktop Excel: After the workbook is opened in desktop Excel, the VBA editor and macros are available again as long as the file uses the .xlsm extension.
Free Microsoft Office alternative

Open Excel Macro-Enabled Workbooks Without Microsoft Excel

When Microsoft Teams and Excel for the web hide your VBA macros, WPS Office offers a free desktop alternative that opens .xlsm workbooks locally, preserves Excel compatibility, and provides a familiar spreadsheet interface.

Opens Excel Macro-Enabled Workbooks (.xlsm) locally so VBA macros are not blocked by a web viewerFree, lightweight Office suite with a familiar interfaceFull compatibility with Microsoft Excel .xls, .xlsx, and .xlsm formatsEasy migration from Microsoft Office with similar ribbon tools and menus
microsoft office alternative - wps office

Frequently Asked Questions

Does Microsoft Teams support VBA macros in Excel files?

No. When you preview or edit an Excel file in Teams, it opens in Excel for the web, which cannot run or edit VBA macros. Download the file and open it in desktop Excel or WPS Office Spreadsheets to work with macros.

Why does my .xlsm workbook show no VBA code after uploading to Teams?

The VBA code is usually still in the .xlsm file, but the Teams web viewer does not display or execute it. Download the original file and open it locally to access the VBA project.

How do I download an Excel file from Microsoft Teams?

Go to the Files tab in the channel or to the chat message containing the attachment, select the file, click More options (⋯), and choose Download.

Can WPS Office open Excel files with VBA macros?

Yes. WPS Office Spreadsheets can open .xlsm files on desktop and supports VBA macros on Windows. Use the desktop app instead of the Teams web preview.

How do I prevent users from losing macros when sharing through Teams?

Share the .xlsm file and tell recipients to download and open it in a desktop spreadsheet app instead of using the Teams preview. Never save the file as a regular .xlsx workbook if you need to keep VBA code.