Microsoft Office Tutorials and References
In Depth Information
OptionButtons have a useful property called GroupName that you should be aware of. In
Figure 19-11, a simple UserForm lists 12 OptionButtons, all with the same objective of eliciting
a selection for a particular month. But what if your UserForm has other sections for user options
that require OptionButtons, such as to select a day of the week, or a print orientation preference of
Landscape or Portrait? You’ll find many reasons to apply OptionButtons to your UserForms, and
you will need each set of options to be a mutually exclusive group.
You have two ways to create a group of mutually exclusive OptionButton controls. You can
place the group inside a Frame (a control that is covered in the next section), or you can use the
GroupName property of the related OptionButtons to group them together. In Figure 19-12, the
OptionButtons have been selected in the UserForm’s design window, and the GroupName property
has been defined with the name “Months.”
Whether organized by GroupName or a Frame control, clicking an OptionButton
sets its value to True and automatically sets the other OptionButtons in the
group (or in the Frame) to False.
Frame controls group related controls together, to provide an organized look and feel when the
UserForm calls for many controls. Figure 19-13 illustrates an example of employing a Frame.