Solver in VBA

G

Guest

Client is using Excel 03/WinXP. She has some code that uses the Solver. It
worked fine with Excel 2000 but now is giving : Compile error:
Sub or Function not defined.

The solver addin is turned on in Tools, Addins. We even readded the Solver
addin by navigating to the xla file to make sure it was looking at the
correct file. Macro security is at Medium and macros are enabled.

When we go into the References in VB Editor, we check the Solver reference,
save the code but when go back into Excel, the reference is once again
unchecked. We even used the browse button here to locate the correct file but
it still won't stick.

We've also checked the Analysis Toolpack and Analysis Toolpack VBA addins
and still having problems.

What else can we try???
 
D

Doug Glancy

maryj,

You could try showing us the code and where the error occurs <g>.

hth,

Doug
 
G

Guest

Hi Jon,

Thanks for you suggestions.

Here is how we modified our code:

Application.Run "solver.xla!solverreset"
Application.Run "solver.xla!solverok", SetCell:="$B$10", MaxMinVal:=3,
ValueOf:="0", ByChange:="$B$11"
Result = Application.Run("solver.xla!solversolve", True)
Application.Run "solver.xla!solverfinish"

It stops at SetCell and gives the error: Compile error: Named argument not
found.
 
D

Dana DeLouis

Hi. Under Help for "Run"...

Remarks
You cannot use named arguments with this method. Arguments must be passed by
position.
Therefore...

Run "Solver.xla!SolverOk", "B10", 3, 0, "B11"
 
G

Guest

I've got the same problem and procceded as instructed... and still nothing...
VBA says "can't find the macro "solver.xla!solverreset""

What to do??

Thank you very much! I don't know how the world would continue spinning if
it weren't people like you =)

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top