g8r777
07-27-2011, 11:54 AM
I have put a group of option buttons on a form that I am creating in Word. The option buttons are inside a table cell (as are all other form elements i.e. text content controls and drop down list content controls).
I have created the following macro (with the help of many in this forum) that resets and clears all form fields I have so far.
Sub ClearFields()
Dim oCC As ContentControl
Dim j As Long
Dim oControls As ContentControls
Dim oLE As ContentControlListEntry
Set oControls = ActiveDocument.ContentControls
For Each oCC In ActiveDocument.Range.ContentControls
If oCC.Type = wdContentControlRichText Then
oCC.Range.Text = " "
End If
Next
For j = 1 To oControls.Count
If oControls(j).Type = wdContentControlDropdownList Then
Set oLE = oControls(j).DropdownListEntries(1)
oLE.Select
End If
Next
End Sub
What I can't figure out is how to code for the clearing of the legacy option buttons. I want to be able to set the form to an entirely clear state with my macro meaning that none of the three option buttons are selected initially.
I appreciate any help.
Thank you,
Brian
I have created the following macro (with the help of many in this forum) that resets and clears all form fields I have so far.
Sub ClearFields()
Dim oCC As ContentControl
Dim j As Long
Dim oControls As ContentControls
Dim oLE As ContentControlListEntry
Set oControls = ActiveDocument.ContentControls
For Each oCC In ActiveDocument.Range.ContentControls
If oCC.Type = wdContentControlRichText Then
oCC.Range.Text = " "
End If
Next
For j = 1 To oControls.Count
If oControls(j).Type = wdContentControlDropdownList Then
Set oLE = oControls(j).DropdownListEntries(1)
oLE.Select
End If
Next
End Sub
What I can't figure out is how to code for the clearing of the legacy option buttons. I want to be able to set the form to an entirely clear state with my macro meaning that none of the three option buttons are selected initially.
I appreciate any help.
Thank you,
Brian