Does anyone have a macro that will replace every formfield check box
that is true with the capital letter "X"? I want the user to click a
commend button on the form and the macro will replace all the check
boxes that are true with a "x" and just delete the check boxes that
are false. I can probably do it myself if I use bookmarks and write
logic for each checkbox but i have over 300 on the word document! Any
help would be excellent, thank you!
Bear - 26 Jun 2007 20:32 GMT
Josh:
This should work. I'm not using the formfields collection because I'm
deleting the fields as I go. I start by unprotecting the document and end by
reprotecting it. Whether or not you reprotect is up to your application. --
Bear
Sub x()
Dim I As Integer
ActiveDocument.Unprotect
For I = ActiveDocument.FormFields.Count To 1 Step -1
With ActiveDocument.FormFields(I)
If .Type = wdFieldFormCheckBox Then
If .CheckBox.Value = True Then
.Range = "X"
Else
.Delete
End If
End If
End With
Next I
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, noreset:=True
End Sub

Signature
Windows XP, Word 2000
Josh - 27 Jun 2007 18:58 GMT
This works great! Thank you so much, Bear!
-Josh
Bear - 27 Jun 2007 19:36 GMT
Josh:
Glad I could help out. Thanks for rating the post!
Bear

Signature
Windows XP, Word 2000
> This works great! Thank you so much, Bear!
>
> -Josh