Excel Solver Add-in Error 1004 and "SolverCode" Compilation Error

Mouaid Sayem 0 Reputatiepunten
2025-08-12T10:14:33.56+00:00

Hello,

I'm experiencing persistent issues with the Solver add-in in Excel. Every time I try to use Solver, I receive Error 1004. I’ve tried multiple troubleshooting steps, including:

  • Using the online version of Excel, but the same error occurs.
  • Removing and re-adding the Solver add-in.
  • Verifying that Solver is correctly installed via Options > Add-ins.
  • Checking that the macro is correctly written.
  • Uninstalling and reinstalling the Solver add-in.
  • Performing a repair of all Microsoft Office apps, including Office 365.

Unfortunately, none of these steps resolved the issue.

Now, when trying to open Solver from a blank Excel file, I get a new error:

"Compilatiefout in verborgen module: SolverCode. Deze fout treedt meestal op wanneer code incompatibel is met de versie, het platform of de architectuur van deze toepassing."

This happens even when opening a new document and trying to launch Solver.

I got an answer from you guys: Go to C:\Users<YourUsername>\AppData\Roaming\Microsoft\Excel\XLSTART

  1. Look for SolverCode > delete .xlam and .xla
  2. Check if issue is still the same Note: Make sure excel is closed when doing this.

If issue is still the same, please reinstall Excel but this time, if you are using 64bit on the current installation, please try to download using 32bit version. Screenshot_5

But it sadly none of these steps worked for me..Screenshot_6

Screenshot_5

I contacted you previsouly about this problem and you told me: Afbeelding van gebruiker

but this didn't work
neither this:
Afbeelding van gebruiker

The problem have been for a long time and i would really appreciate the help

Microsoft 365 en Office | Excel | Overige | Windows
0 opmerkingen Geen opmerkingen

3 antwoorden

Sorteren op: Meest nuttig
  1. John van der Linden 0 Reputatiepunten
    2025-09-04T12:09:06.7466667+00:00

    On my laptop i have the same problem as Mouaid, but on my desktop Solver works. I work with Office 2024 and have the same version on my desktop and laptop.

    If i open an old workbook on my laptop Solver works, but when i open a new workbook the error occurs.

    Was dit antwoord nuttig?

    0 opmerkingen Geen opmerkingen

  2. Mouaid Sayem 0 Reputatiepunten
    2025-08-12T13:37:32.4466667+00:00

    Hi @José Francisco Montilla del Pino ,

    It didn’t work, unfortunately. Before I close Excel, I can still see the Solver add-in enabled, but when I go to C:\Program Files (x86)\Microsoft Office\root\OfficeXX\Library\SOLVER (I couldn’t find it in the regular Program Files folder) and delete the folder, then return to Excel, the “Solver” add-in is removed.

    Whenever I try to re-enable it, I get a message saying it couldn’t find the file.

    I also checked %appdata%\Microsoft\Excel\XLSTART and %appdata%\Microsoft\AddIns, but both folders were empty.

    Was dit antwoord nuttig?

    0 opmerkingen Geen opmerkingen

  3. Francisco Montilla 31,170 Reputatiepunten Independent Advisor
    2025-08-12T11:19:23.14+00:00

    I can see from your screenshots that you're getting two main problems with Excel’s Solver add-in, the "SolverCode" compilation error in a hidden module and Runtime Error 1004 when running Solver-related macros.

    Given that you've already a lot of workarounds, you can try addressing a corrupted Solver add-in installation or a mismatch between Solver's VBA references and your Office version.

    First, close Excel completely. Navigate to:

    C:\Program Files\Microsoft Office\root\OfficeXX\Library\SOLVER
    

    (Replace OfficeXX with your version folder, e.g., Office16 for Office 2016/365.)

    Delete everything inside the SOLVER folder. Open Excel, go to File > Options > Add-ins. At the bottom, select Excel Add-ins and click Go. Uncheck Solver Add-in and click OK. Repeat step 4, then check Solver Add-in again and click OK to reinstall it fresh.

    This should force Excel to recreate the Solver installation from the Office core files and reset its VBA reference paths.

    If after this the error persists, the root cause is often that an old Solver.xlam is still loading from XLSTART or the Roaming profile. In that case, you’ll need to clear any Solver.xlam or SolverCode modules from %appdata%\Microsoft\Excel\XLSTART and %appdata%\Microsoft\AddIns.

    Please let me know the results!

    Was dit antwoord nuttig?


Uw antwoord

Antwoorden kunnen door de auteur van de vraag worden gemarkeerd als Geaccepteerde antwoorden, zodat gebruikers weten met welk antwoord het probleem van de auteur is opgelost.