Premium Solver Macro Problem

S

Suji

Hi all...
I have a problem when i record macro using premium solver.
I have an input sheet where the user enters the data and clicks the
solve button. the premium solver solves the optimisation problem and
displays the result.

when i tried to record the macro for the click operation. excel
crashes....
I have added both the solver and premium solver references.. My code
looks like this when i record...

Code:
Sub solve()
'
Sheets("DataInput-Results").Select
' solve Macro
'

Sheets("Model").Activate

Dim prob As New Problem
prob.Init ActiveSheet
prob.Solver.Optimize
Set prob = Nothing

Sheets("DataInput-Results").Activate
End Sub

Please help me find the solution for this problem.

Thanks
Suji
 
S

Suji

Hi Dana...
I did try that part. But its not working still whenever i add the
premium solver reference and then run the macro.Excel Crashes......

any idea what my problem is?

Suji
 
D

Dana DeLouis

Hi. Sorry it didn't work. I don't know what to suggest at this point.

prob.Init ActiveSheet

I'm sure this is not the problem, but the documentation used the following idea.
Perhaps try that. (They should be the same thing... but you never know)

Sheets("Model").Activate
Dim prob As New Problem
prob.Init Worksheets("Model")


Are you able to run the code without selecting the worksheet "DataInput-Results" first?

Sheets("DataInput-Results").Select
' solve Macro ' <-- Not sure what you are doing here ??

--
Dana DeLouis
 
S

Suji

Hi Dana,
I tried what you suggested putting model in the init thing. I also
removed the other sheet and used only model.activate command.
Evne then it is crashing..
This is totally strange. I have mailed the people who built it.
explaining the problem.
Waiting for their response.

Thanks for your suggestions even though it didnt workout. I appreciate
your help

Suji
 

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