Problem: Solving problems becomes slower the more often I call the SolverOK function in a VBA Excel 2002 code.

I am using the solver add in my program and I was wondering if that will use up a lot of memory and I want to make sure that I release the memory properly. The solver is called several 1000 times in this routine and it could possibly produce a big mess if it does release the memory correctly.

Any help is appreciated.

Code example

'Open solver library
Application.Run "Solver.xla!Auto_Open"

'Clear solver contraints

For i=1 to 100
'Set solver contraints
SolverAdd CellRef:="$H$114", Relation:=1, FormulaText:="$H$103"
SolverAdd CellRef:="$H$119", Relation:=3, FormulaText:="$H$103"
'Call solver and calculate result

SolverOk SetCell:="$H$101", MaxMinVal:=2, ValueOf:="0", ByChange:="$H$103"
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1

'reset solver after the job is done


' close solver library
Application.Run "Solver.xla!Auto_Close"