Ways to create an option group

This page is specific to the Visual Basic for Applications (VBA) Language Reference for Office 2010.

By default, all OptionButton controls on a container (such as a form, a MultiPage, or a Frame) are part of a single option group. This means that selecting one of the buttons automatically sets all other option buttons on the form to False.

If you want more than one option group on the form, there are two ways to create additional groups:

  • Use the GroupName property to identify related buttons.

  • Put related buttons in a Frame on the form.

The first method is recommended over the second because it reduces the number of controls required in the application. This reduces the disk space required for your application and can improve the performance of your application as well.

Note

A TabStrip is not a container. Option buttons in the TabStrip are included in the form's option group. You can use GroupName to create an option group from buttons in a TabStrip.