Gruppenoptionsschaltflächen

Im folgenden Beispiel wird die GroupName-Eigenschaft verwendet, um zwei Gruppen von OptionButton-Steuerelementen im selben Formular zu erstellen.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains five OptionButton controls named OptionButton1 through OptionButton5.

Sub Item_Open() 
 set OptionButton1 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton1") 
 set OptionButton2 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton2") 
 set OptionButton3 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton3") 
 set OptionButton4 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton4") 
 set OptionButton5 = Item.GetInspector.ModifiedFormPages("P.2").Controls("OptionButton5") 
 
 OptionButton1.Caption = "Widgets" 
 OptionButton2.Caption = "Widgets" 
 OptionButton3.Caption = "Widgets" 
 OptionButton1.GroupName = "Widgets" 
 OptionButton2.GroupName = "Widgets" 
 OptionButton3.GroupName = "Widgets" 
 
 OptionButton4.Caption = "Gadgets-Group2" 
 OptionButton5.Caption = "Gadgets-Group2" 
 OptionButton4.GroupName = "Gadgets-Group2" 
 OptionButton5.GroupName = "Gadgets-Group2" 
End Sub

Support und Feedback

Haben Sie Fragen oder Feedback zu Office VBA oder zu dieser Dokumentation? Unter Office VBA-Support und Feedback finden Sie Hilfestellung zu den Möglichkeiten, wie Sie Support erhalten und Feedback abgeben können.