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!

RE: A macro to replace check boxes by david

david
Tue Jun 26 14:32:03 CDT 2007

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

--
Windows XP, Word 2000



Re: A macro to replace check boxes by Josh

Josh
Wed Jun 27 12:58:57 CDT 2007

This works great! Thank you so much, Bear!

-Josh


Re: A macro to replace check boxes by david

david
Wed Jun 27 13:36:05 CDT 2007

Josh:

Glad I could help out. Thanks for rating the post!

Bear

--
Windows XP, Word 2000


"Josh" wrote:

> This works great! Thank you so much, Bear!
>
> -Josh
>
>