How to Recover VBA Macros Removed from an XLSM File in Excel for Mac
Question details
The user needs to recover or transfer VBA macros from a Windows-created XLSM file that Excel for Mac automatically removes due to reported damage or incompatibility.

- Product
- Microsoft Excel
- Device & OS
- Mac and Windows
- Scenario
- Opening a Windows-created XLSM workbook containing VBA macros in Excel for Mac.
- Observed behavior
- Excel for Mac displays a damaged content error and removes the vbaProject.bin file, resulting in the complete loss of VBA macros within the workbook.
Ensure you have access to a Windows PC with Excel installed to open the original, uncorrupted XLSM file, and keep a backup of your original workbook before attempting the module transfer.
Export and Re-import VBA Modules via Windows
By manually exporting the VBA modules on a Windows PC and re-importing them into a fresh file on your Mac, you can bypass the structural corruption or incompatibility issues triggering the error.
Excel for Mac sometimes struggles to read the embedded vbaProject.bin file generated by Windows, flagging it as damaged. Rebuilding the macro structure manually on the Mac ensures that the macOS version of Excel can properly compile and read the VBA project.
On your Windows PC, open the original XLSM file in Excel. Press Alt + F11 to open the VBA Editor. In the Project Explorer pane on the left, right-click each VBA module and select 'Export File' to save them (.bas format) to a folder.
Close the VBA Editor. Go to File > Save As, and choose 'Excel Workbook (*.xlsx)' from the format dropdown. This creates a clean, macro-free version of your spreadsheet data.
Copy both the newly saved .xlsx workbook and the folder containing your exported VBA module files to your Mac using a USB drive or cloud storage.
Open the .xlsx file in Excel for Mac. Press Option + F11 to open the Mac VBA Editor. Right-click in the Project Explorer pane, select 'Import File', and select the previously transferred module files.
Once all modules are imported, click File > Save As in Excel for Mac, and select 'Excel Macro-Enabled Workbook (*.xlsm)' from the format options to preserve the newly rebuilt macros.

Try WPS Office for Seamless Cross-Platform Compatibility
Avoid frustrating 'damaged content' errors when sharing files between Windows and Mac. WPS Office provides a lightweight, highly compatible, and free alternative to Microsoft Office, ensuring your spreadsheets and documents open smoothly across all your devices without altering your original layouts.
- 1. Download the Installer: Visit the official WPS Office website and download the free installation package tailored for your operating system (Mac or Windows).
- 2. Install WPS Office: Run the downloaded installer and follow the simple on-screen instructions to complete the setup in just a few minutes.
- 3. Open Your Workbooks: Launch WPS Spreadsheet and easily open your existing Excel workbooks to enjoy seamless cross-platform editing.

Frequently Asked Questions
Why does Excel for Mac remove the vbaProject.bin file automatically?
Excel for Mac removes this file when it detects structural corruption or encounters Windows-specific VBA components (like ActiveX controls) that macOS cannot process. To protect the rest of the workbook data, Excel isolates and strips the 'damaged' macro content.
Can I run all Windows Excel macros on a Mac?
No. While basic VBA logic is cross-platform, macros that rely on Windows OS features, ActiveX controls, specific DLLs, or the Windows File System Object will not run on Excel for Mac without being modified for macOS equivalents.
How do I check if my VBA code is causing the incompatibility?
Try compiling your code on the Mac VBA Editor by going to Debug > Compile VBAProject. If there are syntax errors or missing references related to Windows-only libraries, the compiler will highlight the incompatible lines of code.
Is there a specific format that works better for cross-platform macros?
While .xlsm is standard, some users find that saving the file as an Excel Binary Workbook (.xlsb) minimizes cross-platform corruption risks. However, the best approach is to ensure your VBA code avoids calling operating system-specific functions.




