Re: Form question by Greg
Greg
Tue Dec 05 14:34:48 CST 2006
This assumes that the first item of each dropdown field is one or more
spaces to produce a blank field:
Sub Test()
Dim oFF As FormField
Dim oFFs As FormFields
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect
End If
Set oFFs = ActiveDocument.FormFields
For Each oFF In oFFs
Select Case oFF.Type
Case wdFieldFormCheckBox
If oFF.Result = False Then
oFF.Range.Font.Hidden = True
End If
Case wdFieldFormDropDown
If oFF.DropDown.Value = 1 Then
oFF.Range.Font.Hidden = True
End If
End Select
Next
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub
Sub Reset()
Dim oFF As FormField
Dim oFFs As FormFields
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect
End If
Set oFFs = ActiveDocument.FormFields
For Each oFF In oFFs
oFF.Range.Font.Hidden = False
Next
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub
jb914 wrote:
> i have a form that includes multiple sections. sections can have checkboxes
> and/or dropdown fields.
>
> i want to allow the user to go thru the sections and check boxes pick from
> drop downs.
>
> once they are done i want them to have a toolbar button that will "hide" any
> unchecked boxes and any unselected drop down boxes.
>
> I don't want to delete the unchecked/unselected boxes since the user will
> reuse the document in the future. I just need the unchecked boxes and any
> unselected drop down boxes to be hidden, so, the document can be
> view/printed/faxed, ect without all the clutter of the unneccesary text.
>
> any advice would be appreciated.
>
> thanks
> JB914