Though, as with worksheet controls, it is beyond the
scope of this tutorial to give detailed instruction on the design and use of
forms in Visual Basic, we do offer a brief introduction here as they can add
great flexibility to your models.
A key benefit is that they allow interaction with
your VBA program during run-time.
In the FastSlow example, clicking the "Run FastSlow1"
button on the worksheet causes the FastSlow User Form (below) to appear.
From this form the user chooses to run
the model in "Fast" or "Slow" mode. The user's input is read into the VBA
code as a variable, and the code uses that value in "if - then" blocks to
determine what gets processed.
To incorporate a User Form in your VBA
program, select "Insert - UserForm" from the drop-down menu in the Visual Basic
This inserts a blank User Form into your
project, which you can then modify using the Controls Toolbox within the Visual