View Single Post
  #22   Report Post  
Posted to microsoft.public.excel.programming
programmernovice[_2_] programmernovice[_2_] is offline
external usenet poster
 
Posts: 61
Default Problem loading Solver

On Monday, December 16, 2019 at 2:34:27 PM UTC-6, Peter T wrote:
"programmernovice" wrote in message
Thanks Peter & Garry. I tried following all instructions, even removing
and re-adding Excel in Programs & Features (Windows 10) Now can't run the
following script:

solverok setcell:=Range("Collect.xlsm!absDif"), maxminval:=2,
valueof:="0", bychange:=Range("Collect.xlsm!absDif").Offset(0, -1)
solverSolve (True)
solverfinish (True)

I get:

Compile error:
Can't find project or library

Any ideas? Thanks for your patience, fellows!


I failed to mention that the script shown was obtained by recording the
procedure under the Record macro option of Excel 2007.


As Claus said you need to add a reference to the solver addin, though in an
English system if would be in Tools / References, not "Extras" :)

If solver.xlam is already loaded tick "SOLVER" which you should see near the
top of the list. But just for this it doesn't need to be loaded or installed
as an addin, just browse to the file in References. In future it should load
automatically with your file if not already loaded.

Peter T


Many thanks to Peter, Garry, and now Claus. I resolved all my problems. One last question (I hope). The final pop-up from Solver (Solver Results) requires user to click on the OK button to close it. Is there some way via VBA to do this and completely automate the process.

You guys are incredible resources for a tyro like myself. Thanks for helping me out.