Palisade Knowledge Base

HomeTechniques and TipsEvolver and RISKOptimizerClearing RISKOptimizer Settings without Clearing @RISK Settings

14.24. Clearing RISKOptimizer Settings without Clearing @RISK Settings

Applies to: RISKOptimizer in @RISK 6.x/7.x Industrial Edition

How can I clear the model definition and other RISKOptimizer settings?

The easy way is Utilities » Clear @RISK Data.  The Settings check box will remove the RISKOptimizer information. 

However, it will also remove all the @RISK simulation settings. If you don't want to do this, you can create and run a Visual Basic macro to delete just the RISKOptimizer model, without affecting @RISK's simulation settings.

  1. Press Alt-F11 to open the Visual Basic Editor, then F7 to open the code window.

  2. Paste this code into the window:

    Sub ClearOptimizerModel( )
        RISKOptimizer.ModelWorkbook.OptimizationSettings.Engine.OptimizationEngine = OptEngineAutomatic
        RISKOptimizer.ModelWorkbook.OptimizationSettings.Runtime.TrialCountStoppingCondition = False
        RISKOptimizer.ModelWorkbook.OptimizationSettings.Runtime.ProgressStoppingCondition = False
        RISKOptimizer.ModelWorkbook.OptimizationSettings.Runtime.TimeSpanStoppingCondition = False
        RISKOptimizer.ModelWorkbook.OptimizationSettings.Runtime.StopOnErrors = False
        RISKOptimizer.ModelWorkbook.OptimizationSettings.Runtime.FormulaStoppingCondition = False   
    End Sub
  3. Please see Setting References in Visual Basic for the appropriate references and how to set them.

  4. Click somewhere in the middle of the ClearOptimizerModel routine, and press F5 to run the code.  This will remove the RISKOptimizer model without affecting the @RISK simulation settings.

  5. If you leave the code in place, Excel 2007 or above will no longer store the workbook as an .XLSX but instead will use .XLSM format.  This may present you or anyone who opens your workbook with a macro security prompt.  To prevent that, you can delete the pasted code before you save the workbook.  The RISKOptimizer model will not return when you delete the code.

Last edited: 2015-07-23

This page was: Helpful | Not Helpful