logo
search
Excel Error Codes

How to Fix Excel Run-Time Error 5 on Windows Computers

Olivia MillerOlivia Miller Oct 26, 2026 870 views

Question details

A user encounters Run-Time Error 5 when opening an XLSM macro file on a different computer, despite the file working correctly on the original machine.

How to Fix Excel Run-Time Error 5 on Windows Computers
Product
Microsoft Excel
Device & OS
Windows
Scenario
Sharing and executing VBA macros (.xlsm) across multiple computers with potentially different system setups.
Observed behavior
The macro triggers a Run-Time Error 5 on a specific user's computer, likely due to VBA code compatibility, missing references, or 32-bit versus 64-bit architectural differences.
Before you start

Before making changes, verify that macros are fully enabled in the Trust Center settings on the affected computer, and ensure the user has the necessary permissions to access any network folders referenced in the VBA code.

Solution 1Recommended

Isolate the XLSM File and Verify Excel Architecture

Determine if the issue is specific to the workbook itself or caused by differences between 32-bit and 64-bit Excel installations.

Run-Time Error 5 (Invalid Procedure Call or Argument) frequently occurs when a macro written on a 32-bit version of Excel is executed on a 64-bit version without proper API declarations, or when a file becomes corrupted during transfer.

1
Test with an alternative file

Send a different, known-working XLSM file to the affected user. Have them open it and run a basic macro to see if the issue is isolated to a specific workbook.

2
Open Excel Account Settings

On both the working and non-working computers, open Excel, click on 'File' in the top ribbon, and select 'Account' from the left-hand menu.

3
Check the Excel Version

Click the 'About Excel' button. Note the exact build number and check whether the installation is 32-bit or 64-bit (listed at the end of the first line in the dialog box).

4
Update API Declarations

If the original PC is 32-bit and the affected PC is 64-bit, open the VBA Editor (Alt + F11) and update any Windows API 'Declare' statements by adding the 'PtrSafe' keyword.

Isolate the XLSM File and Verify Excel Architecture
Sharing Workbooks: Compressing the XLSM file into a ZIP archive before sending it via email or network drives can sometimes prevent unexpected file corruption that leads to execution errors.
Free Microsoft Office alternative

Try WPS Office for Seamless Spreadsheet Compatibility

If you frequently encounter version conflicts and architecture errors in Microsoft Excel, consider switching to WPS Office. It provides a highly compatible environment for your spreadsheets with a familiar interface, reducing the hassle of cross-device file sharing.

  1. 1. Download the Installer: Visit the official WPS website and click the download button to get the latest WPS Office installation package.
  2. 2. Install WPS Office: Run the downloaded executable file and follow the simple on-screen instructions to install the suite on your computer.
  3. 3. Open Your Spreadsheets: Launch WPS Spreadsheet and directly open your existing Excel files to enjoy seamless editing and formatting compatibility.
Fully compatible with Microsoft Excel formats including .xlsx, .xls, .xlsm, and .csv.Lightweight design that runs smoothly and efficiently on all major Windows versions.Familiar user interface requiring zero learning curve for regular Excel users.Free to use with built-in robust tools for data analysis, charting, and sharing.
microsoft office alternative - wps office

Frequently Asked Questions

What does Run-Time Error 5 mean in Excel VBA?

Run-Time Error 5 indicates an 'Invalid Procedure Call or Argument'. This usually happens when a macro passes an unacceptable value to a function, attempts to call a function that is not supported by the current Excel environment, or tries to access a file path that does not exist on the computer.

Why do macros work on a 32-bit Excel but fail on a 64-bit Excel?

64-bit versions of Excel require VBA code that calls Windows API functions to be explicitly updated for 64-bit environments. You must modify the code to include the 'PtrSafe' keyword in Declare statements and use the 'LongPtr' data type for pointers and handles to avoid memory access errors.

How do I check if my Excel is 32-bit or 64-bit?

Open Microsoft Excel, click on the 'File' tab, then select 'Account' at the bottom of the left sidebar. Click the 'About Excel' button. A dialog box will appear displaying the version number, and it will clearly indicate whether it is 32-bit or 64-bit at the end of the very first line of text.