在 VBA 中使用 Excel Solver 时捕获最大时间/迭代对话框
我在 VBA 循环中使用 Excel 2003 中的内置求解器来求解许多不同的问题。有时,求解器会达到最大时间或迭代限制,这会导致出现弹出对话框,询问用户是否要继续、停止或结束。在所有情况下,我都希望它结束,并继续循环的下一行。这将防止用户每次都必须坐在那里进行响应。
似乎有人在这里尝试过,但失败了: http://www .excelforum.com/excel-programming/483175-捕捉-max-iterations-stop-of-solver-in-vba.html
I am using the built-in solver in Excel 2003 within a VBA loop to solver a number of different problems. Occasionally, the solver hits the maximum time or iterations limit, which causes a pop-up dialog box to appear asking whether the user wants to Continue, Stop, or End. In all cases I want it to end, and proceed to the next line of the loop. This will prevent a user from having to sit there and respond each time.
It appears someone took a stab at it here, but failed:
http://www.excelforum.com/excel-programming/483175-catching-max-iterations-stop-of-solver-in-vba.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个示例解决方案:
它使用 SolverSolve PassThru 方法调用一个函数来处理每次迭代的求解器结果。
here's a sample solution:
it uses the SolverSolve PassThru method to call a function to handle the solver result at each iteration.