RobertDAltman
7 years agoOccasional Contributor
How to access UserForm radio button Caption
I have a UserForm that I display from JavaScript
var userForm = UserForms.StartupForm; var formResult = userForm.ShowModal();
The UserForm contains a RadioGroup with several radio buttons on it. How do I fetch the Caption property of the selected radio button?
Many thanks to Evgeny in tech support for this solution:
// In this example, a form named MyForm contains a radio button group
// named radioGroup.
// Display a modal form var frm = UserForms.MyForm; var modalResult = frm.ShowModal(); // Get the selected radio button var idx = frm.radioGroup.ItemIndex; var rb = frm.radioGroup.ChildControl(idx); // Access properties on the radio button control var selectedCaption = rb.Caption;Note that code completion doesn't display any properties or methods for the radio button object.