lundi 6 janvier 2020

VBA needed for checking a specific check box based on text box result

Working in Word 2010, I need VBA code for a form that will check one of two ActiveX check boxes based on text set to populate into an ActiveX text field. (Male or Female) I'm a novice and have tried various variations of the code below:

Sub copyMaleFemale()
Dim ff As String
ff = CurrentFormField.Result

If ff = ("Male") Then 
ActiveDocument.FormFields("Check1").Result = Checked 
ActiveDocument.FormFields("Check2").Result = Unchecked

ElseIf ff = ("Female") Then
ActiveDocument.FormFields("Check1").Result = Checked
ActiveDocument.FormFields("Check2").Result = Unchecked

End If

End Sub

I appreciate any suggestions.




Aucun commentaire:

Enregistrer un commentaire