?
Solved

VBA to Accept Solver result

Posted on 2005-02-27
3
Medium Priority
?
745 Views
Last Modified: 2008-02-01
I used to know how to do this but have forgotten...

I am running a couple of solver scenarios in sequence, and would rather not click on "OK" to accept the result from each scenario.  This action does not show up in the code when recording a macro.
0
Comment
Question by:samsoro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Expert Comment

by:reedsr
ID: 13419385
have you tried:

Application.DisplayAlerts = False

... Code for solver ...

Application.DisplayAlerts = True

make sure you turn it back to true or else you won't get alerts when the macro is done running
0
 

Author Comment

by:samsoro
ID: 13420408
Actually that does not appear to work either....but I did some further digging and here is the right answer:

SolverSolve userfinish:=True

When recording a macro, it records 'SolverSolve', but not the last part.

If anyone can point me to where documentation on this stuff, I would be happy to award the points.

Thanks.
0
 
LVL 4

Accepted Solution

by:
reedsr earned 375 total points
ID: 13421544
SolverSolve Function
See Also Example Specifics
Begins a Solver solution run. Equivalent to clicking Solve in the Solver Parameters dialog box.

Before you use this function, you must establish a reference to the Solver add-in. With a Visual Basic module active, click References on the Tools menu, and then select the Solver.xla check box under Available References. If Solver.xla doesn't appear under Available References, click Browse and open Solver.xla in the \Office\Library subfolder.

SolverSolve(UserFinish, ShowRef)

UserFinish   Optional Variant. True to return the results without displaying the Solver Results dialog box. False or omitted to return the results and display the Solver Results dialog box.

ShowRef   Optional Variant. Used only if True is passed to the StepThru argument of the SolverOptions function. You can pass the name of a macro (as a string) as the ShowRef argument. This macro is then called whenever Solver returns an intermediate solution.


 the example can be found in the VBA help index under SolverSolve;
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Progress
Suggested Courses
Course of the Month8 days, 8 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question