PDA

View Full Version : How to enable a text box depending on radio button groups by vba in word



infomamun
06-18-2018, 07:11 AM
I have following activex control in a ms word form
1. Radio Button Group: Name: radioGender
a) radio button: Female> Group Name: radioGender, Name: radioFemale, value=True
b) radio button: Male> Group Name: radioGender, Name: radioMale, value=False
2. Text box: Name: TextBox1I want if a user select Female radio button, then the Textbox1 will be enabled, otherwise Textbox1 will be disabled.

I can get the TextBox1 enabled if set a code on click of Female and Male Radio Option button Separately.


Private Sub radioFemale_Click()
TextBox1.Enabled = True
End Sub




Private Sub radioMale_Click()
TextBox1.Enabled = False
End Sub


But I want instead coding on each radio button, if I can coding on radio button groups, so that based on the selected value of radio button groups, TextBox1 can be enabled/disabled.

What should be the vba code in this case? Please note that I have activex radiobutton in ms word 2010 form.

macropod
06-19-2018, 12:11 AM
Cross-posted at: https://stackoverflow.com/questions/50910935/how-to-enable-a-text-box-depending-on-radio-button-groups-by-vba-in-word
Please read VBA Express' policy on Cross-Posting in item 3 of the rules: http://www.vbaexpress.com/forum/faq.php?faq=new_faq_item#faq_new_faq_item3