Why VBA Code Disappears in Microsoft Teams and How to Open .xlsm Macros
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 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.
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.
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.
Select the workbook, click More options (⋯), and choose Download. Save the file to a local folder on your computer.
Right-click the downloaded file and select Open with > Excel, or open Excel and use File > Open to browse to the file.
In Excel, click File > Save As, confirm the file type is Excel Macro-Enabled Workbook (.xlsm), and save it if needed.
Open the .xlsm workbook in WPS Office Spreadsheets
If you do not have desktop Excel available, use WPS Office Spreadsheets to download and open the macro-enabled file locally.
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.

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.




