Forum Discussion
Compile error in Hidden Module: SolverCode
Hi y'all,
As the title says, I keep getting this error whenever I try to use solver. I've tried redownloading microsoft office, but this didn't fix the issue. Any advice?
3 Replies
- ForensicECopper Contributor
...Update! I found another suggestion on-line about Enabling Active X Controls; in Excel go to Options>Trust Center>Trust Settings "Enable all controls" then restart excel. This resolved the issue but is it safe to have all controls enabled like this?
- ForensicECopper Contributor
Hi Nikolino. I also have this problem and have tried all your recommendations with no success, including Online Repair.
When I open old Workbooks, Solver works ok, but if I open a new sheet in the old Workbook or I open a new Workbook, I get the compile error when I try to open Solver. So I can only use Solver in old work sheets in old workbooks. Any idea how I can resolve this? I've tried everything you mentioned above. Thanks.
- NikolinoDEPlatinum Contributor
You should not be seeing a Compile error in hidden module: SolverCode. That error usually means something is broken or corrupted in the Solver add-in or its related macro files.
Disable and Re-enable the Solver Add-in
This often clears the corrupted reference.
- Open Excel
- Go to File → Options → Add-ins
- At the bottom, next to Manage, choose Excel Add-ins and click Go...
- Uncheck "Solver Add-in"
- Click OK
- Go back and re-check "Solver Add-in" to re-enable it
Then close Excel completely and reopen it.
Or…
Delete Corrupt Solver VBA Components (if they exist)
You may have a corrupt file like SolverCode.bas or a leftover macro.
- Open Excel
- Press Alt + F11 to open the Visual Basic for Applications (VBA) editor
- Look in the Modules area for anything named SolverCode
- If it's there, right-click and remove it
- Close the VBA editor and try using Solver again
If the issue persists Repair Office 365
Go to Control Panel → Programs → Programs and Features
Find Microsoft 365 → click Change
Choose Quick Repair
If that doesn’t work, try Online Repair
Sometimes Excel caches control settings that can corrupt Solver.
- Press Windows + R to open Run
- Type:
%appdata%\Microsoft\Forms
3. Delete all .exd files there
Then relaunch Excel and try Solver again.
I hope I could help