Hi Mouaid, this is Kimberly. I'm glad to assist you today.
It sounds like you've already taken a thorough approach to troubleshooting the Excel Solver Add-in Error 1004 and the "SolverCode" compilation error, but issue persisted.
Since the error is about a compilation error in a hidden module, it likely involves VBA. Please try this:
Press Windows + R, type:
%programfiles%\Microsoft Office
Navigate into your Office folder (Office16, Office15, etc., depending on your version).
Find and run VBE7.DLL if present, this can register the VBA environment.
Open Command Prompt as Administrator and run:
regsvr32.exe VBE7.DLL
This re-registers the VBA engine, which Solver relies on.
If you need more from me apart from the solutions I provided, please let me know.
Best regards,
Kimberly