Solver in VBA

  • Thread starter Thread starter Demian
  • Start date Start date
D

Demian

Hallo,
do You know how to use in VBA macros Solver Tool. I have massage that Solver
Function is not defined although normally I can use in my worksheet.
Thanks a lot
Tom
 
Hi Tom,

This is what J.E. McGimpsey answered some time ago:
<
I think this is in VBA Help if you search on the Solver functions, but you
need to set a reference to the Solver.xla.

In the VBE, select Tools/References and check the SOLVER checkbox. Your sub
should then compile OK.
--

Kind Regards,

Niek Otten

Microsoft MVP - Excel
 
Niek said:
Hi Tom,

This is what J.E. McGimpsey answered some time ago:
<
I think this is in VBA Help if you search on the Solver functions, but you
need to set a reference to the Solver.xla.

In the VBE, select Tools/References and check the SOLVER checkbox. Your sub
should then compile OK.

In case this still doesn't work, try changing "Solver" to "Solv" in all
the calls.

Ex:

SolverAdd ....

to

SolvAdd ...

I'm not sure how I got to this but I had the same problem and this
solved it.

Regards,
 
In case this still doesn't work, try changing "Solver" to "Solv" in all
the calls.

Beto - Don't know of course, but are you using the US English version?
Sounds like you are having a "localization" problem in your code. "SolvAdd"
is the internal subroutine that Solver uses, but normally, it should be
called with "SolverAdd"

I don't know of course, but I would be curious to know what is displayed if
you run this code:

Sub Find_SolverAdd_Name()
'// Dana DeLouis
MsgBox Workbooks("Solver.xla").Sheets("Language").Range("A191")
End Sub

Thanks for you feedback. :>)
 
Dana said:
Beto - Don't know of course, but are you using the US English version?

No, I'm using a spanish version of Excel 2002-SP2, I don't know if there
is more than one spanish version.
Sounds like you are having a "localization" problem in your code. "SolvAdd"
is the internal subroutine that Solver uses, but normally, it should be
called with "SolverAdd"

I made a simple example, I set the reference to SOLVER and it failed
with the recorded code. I changed it as I said before and it worked.
I don't know of course, but I would be curious to know what is displayed if
you run this code:
MsgBox Workbooks("Solver.xla").Sheets("Language").Range("A191")

Running this in the Inmediate Window it returned "SolverAdd".
Thanks for you feedback. :>)

You're welcome, I hope to have helped calming your curiosity.

Regards,
PS: What do you mean by "localization problem"?
 
Beto said:
No, I'm using a spanish version of Excel 2002-SP2, I don't know if there
is more than one spanish version.


I made a simple example, I set the reference to SOLVER and it failed
with the recorded code. I changed it as I said before and it worked.



Running this in the Inmediate Window it returned "SolverAdd".


You're welcome, I hope to have helped calming your curiosity.

Regards,
PS: What do you mean by "localization problem"?

It sounds like you are having the same problem we encountered with a
client. We developed a forecasting system using Solver that they
distributed to their European units. The system only ran in France and
the UK, but failed in all other countries. "Localization" is when you
modify a program to run in a particular country (correct language,
currency, date formatting, etc.).

Apparently there was a localization problem with French Excel 2002
that was fixed that sounds exactly like the problem described in this
thread:

http://support.microsoft.com/default.aspx?scid=kb;en-us;320302

To clarify, does Solver work on your Spanish copy of Excel 2002 with
SP-2 installed? Or did it only work when you changed the call from
"SolverAdd" to "SolvAdd"?

Thanks,

Brett
 

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

Back
Top