How to Fix Excel 365 Compatibility Issues with Excel 2010 XLSM Files and VBA
Question details
The user needs to know how to ensure Excel 2010 XLSM workbooks and VBA macros function correctly when opened in Microsoft Excel 365.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Opening and running legacy Excel 2010 XLSM files with VBA macros in the newer Excel 365 environment.
- Observed behavior
- While generally compatible, users may experience macro security blocks, 64-bit Office API declaration errors, or missing obsolete library references.
Ensure you have a backup copy of your original Excel 2010 XLSM file before making any VBA code modifications in Excel 365, and verify that the file comes from a trusted source before enabling macros.
Update VBA Code for 64-bit Compatibility and Fix References
Modify Windows API declarations and repair missing library references to make the VBA code compatible with 64-bit Excel 365.
When migrating from Excel 2010 (often 32-bit) to Excel 365 (usually 64-bit), Windows API declarations in VBA must be updated. Additionally, older library references may become obsolete and need to be repaired.
Open the XLSM file in the Excel 365 desktop application and press Alt + F11 to open the VBA Editor.
Go to Tools > References in the top menu. Uncheck any libraries marked as 'MISSING', then locate and check their updated equivalents in the list.
Locate any 'Declare' statements in your VBA modules and add the 'PtrSafe' keyword (e.g., 'Declare PtrSafe Function').
Update data types that handle pointers or handles from 'Long' to 'LongPtr' to ensure 64-bit compatibility.
Click Debug > Compile VBAProject to ensure no syntax errors remain, then save the workbook.

Adjust Macro Security Settings
Unblock macros that Excel 365 might restrict due to updated security policies for files originating from the internet or older versions.
Try WPS Office for Seamless Spreadsheet Compatibility
If you are struggling with Microsoft Office version compatibility or subscription costs, WPS Office provides a lightweight, highly compatible, and free alternative. It supports standard Microsoft Excel formats, including XLS, XLSX, and CSV, with a familiar user interface that requires no learning curve.
- 1. Download WPS Office: Download and install WPS Office from the official website.
- 2. Open WPS Spreadsheets: Launch WPS Spreadsheets and click File > Open.
- 3. Select Your File: Select your Excel workbook to view and edit your data seamlessly.

Frequently Asked Questions
Why do my Excel 2010 macros show a 'Compile error' in Excel 365?
This usually happens because Excel 365 is 64-bit, while Excel 2010 was likely 32-bit. You need to update your Windows API declarations by adding the 'PtrSafe' attribute and changing 'Long' to 'LongPtr' for handles and pointers.
Can I run XLSM macros in Excel for the web?
No, Excel for the web does not support running or editing VBA macros. You can upload and view the XLSM file, but you must open it in the desktop version of Excel to execute the macros.
How do I fix 'Missing' references in my VBA project?
Open the VBA Editor (Alt + F11), go to Tools > References, and look for items starting with 'MISSING:'. Uncheck these items, then scroll down to find and check the updated version of that specific library for your current Office installation.




