Fix Excel VBA Overflow Errors When Opening an XLSM File on Mac
Question details
The user needs to resolve an Excel VBA overflow or inconsistent macro launch issue that occurs when an XLSM workbook is opened by double-clicking on a Mac.

- Product
- Microsoft Excel for Mac
- Device & OS
- macOS
- Scenario
- An XLSM workbook behaves differently when launched from Finder than when it is opened from within Excel.
- Observed behavior
- The VBA application may show an overflow error or run inconsistently depending on how the workbook is opened.
Open the workbook from Excel first and make sure macros are enabled if prompted. Keep the original XLSM file available while rebuilding so you can copy its VBA code and compare required references.
Rebuild the VBA project in a new XLSM workbook
Use this method when the workbook runs differently depending on its launch method, as a damaged VBA project can cause inconsistent behavior.
Saving a copy as XLSX removes the existing VBA project. Saving that clean copy back to XLSM creates a new VBA container, allowing you to transfer the code and forms from the original workbook.
Copy every required project component, including standard modules, class modules, UserForms, worksheet code, and ThisWorkbook code. Do not assume that only standard modules contain startup logic.
In Excel for Mac, open the affected workbook and select File > Save As. Choose Excel Workbook (.xlsx), provide a new file name, and confirm that you want to remove macros when Excel displays the format warning.
Close the files, reopen the new .xlsx copy in Excel, then select File > Save As and choose Excel Macro-Enabled Workbook (.xlsm). This creates a new VBA project for the rebuilt workbook.
In Excel, select Developer > Visual Basic. If the Developer tab is hidden, select Excel > Preferences > Ribbon & Toolbar and enable Developer first.
In the original workbook project, open each module, class module, worksheet object, and ThisWorkbook object in the Project Explorer, then copy its code into the matching location in the rebuilt workbook. Recreate or import any UserForms and copy their code as needed.
Select File > Save in the rebuilt XLSM workbook. Close Excel, then test opening the rebuilt file from Finder and again through Excel > File > Open to confirm that startup behavior is consistent.

Check missing or changed VBA references
Use this method after rebuilding the project or when code fails at startup because a referenced library is unavailable on the Mac.
Use Excel to open the workbook while investigating the launch difference
Use this as a temporary workaround when opening the file from Finder triggers the error but opening it from Excel does not.
Use WPS Office for Compatible Spreadsheet Editing After Repairing Your XLSM File
If the issue is specific to Microsoft Excel for Mac and its VBA launch process, WPS Office provides a free, lightweight alternative for opening and editing compatible spreadsheet files. Its familiar interface supports a smooth transition for everyday workbook work, while macro-heavy XLSM files should be tested carefully before production use.
- 1. Install WPS Office: Download and install WPS Office Free on your Mac, then open WPS Spreadsheets from the application.
- 2. Open a copy of the workbook: Select Open and choose a copy of your XLSM workbook to review worksheets, formulas, and workbook content without replacing the original.
- 3. Verify workbook compatibility: Check key sheets, formulas, charts, and formatting, then test any required macro-dependent workflow separately before relying on the file.

Frequently Asked Questions
Why does my XLSM file work when opened from Excel but fail when double-clicked on a Mac?
The two launch methods can trigger different startup timing, add-in loading, security behavior, or VBA project initialization. A damaged VBA project or code in ThisWorkbook, such as Workbook_Open, can make the difference more noticeable.
Will saving an XLSM workbook as XLSX remove the macros?
Yes. Excel removes the VBA project when you save as .xlsx. Use this only to create a clean workbook copy, then save that copy as .xlsm before adding the required VBA code back.
Which VBA items must be copied into a rebuilt workbook?
Copy standard modules, class modules, UserForms, worksheet code modules, and ThisWorkbook code. Also review named ranges, buttons, and any workbook features that call macros.
Where can I check for missing VBA references in Excel for Mac?
Open Developer > Visual Basic, then select Tools > References in the Visual Basic Editor. Clear entries marked MISSING or replace them with a compatible library.
Can a Windows VBA project run unchanged in Excel for Mac?
Not always. VBA code that uses ActiveX controls, Windows API calls, COM automation, or Windows-only libraries may need to be replaced or rewritten for macOS.




