Propriedade GroupName

Cria um grupo de controles OptionButton mutuamente exclusivos.

Sintaxe

objeto. GroupName [= String ]

A sintaxe da propriedade GroupName tem estas partes:

Sair Descrição
objeto Obrigatório. Um OptionButton válido.
String Opcional. O nome do grupo que inclui o OptionButton. Use a mesma configuração para todos os botões do grupo. The default setting is an empty string.

Comentários

To create a group of mutually exclusive OptionButton controls, you can put the buttons in a Frame on your form, or you can use the GroupName property. GroupName is more efficient for the following reasons:

  • Você não precisa incluir um Quadro para cada grupo. By not using a Frame, you reduce the number of controls on the form, and in turn, improve performance and reduce the size of the form.

  • You have more design flexibility. If you use a Frame to create the group, all the buttons must be inside the Frame. If you want more than one group, you must have one Frame for each group. However, if you use GroupName to create the group, the group can include option buttons anywhere on the form. If you want more than one group, specify a unique name for each group; you can still place the individual controls anywhere on the form.

  • Você pode criar botões com planos de fundo transparentes , o que pode melhorar a aparência visual do formulário. The Frame is not a transparent control.

Regardless of which method you use to create the group of buttons, clicking one button in a group sets all other buttons in the same group to False. Todos os botões de opção com o mesmo GroupName em um único contêiner são mutuamente exclusivos. Use o mesmo nome de grupo em dois contêineres, mas isso cria dois grupos (um em cada contêiner) em vez de um grupo que inclui ambos os contêineres.

For example, assume your form includes some option buttons and a MultiPage that also includes option buttons. Os botões de opção no MultiPage são um grupo e os botões no formulário são outro grupo. Os dois grupos não se afetam. Changing the setting of a button on the MultiPage does not affect the buttons on the form.

Confira também

Suporte e comentários

Tem dúvidas ou quer enviar comentários sobre o VBA para Office ou sobre esta documentação? Confira Suporte e comentários sobre o VBA para Office a fim de obter orientação sobre as maneiras pelas quais você pode receber suporte e fornecer comentários.