Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2006

Tip: Looking for answers? Try searching our database.

Form question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jb914 - 05 Dec 2006 20:04 GMT
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
Greg Maxey - 05 Dec 2006 20:34 GMT
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

> i have a form that includes multiple sections.  sections can have checkboxes
> and/or dropdown fields.
[quoted text clipped - 14 lines]
> thanks
> JB914
jb914 - 07 Dec 2006 15:49 GMT
Thanks Greg!!  That helps.

> This assumes that the first item of each dropdown field is one or more
> spaces to produce a blank field:
[quoted text clipped - 54 lines]
>> thanks
>> JB914
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.