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 / July 2007

Tip: Looking for answers? Try searching our database.

Conditional Check boxes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dave@iversonlang.com - 06 Jul 2007 20:55 GMT
Hello,

I am working with a protected form template. What I am trying to do is
to make certain check boxes (from the Forms toolbar not ActiveX
controls) appear when a certain selection is made from a dropdown
menu.

This way, the user cannot select the wrong option.

Would it be a simple If...Then VBA statement?

Any help would be great!

Thanks,

Dave O
Helmut Weber - 07 Jul 2007 11:09 GMT
Hi Dave,

not simple, IMHO.

You may set the font of the range of a checkbox to hidden.
But for that you have to remove the protection.
Removing the protection resets the values of fields
to their default values.
Therefore it seems, you have to remember the values
(results) of the fields and restore them after
changing the font.hidden property.

Sub MyExit67003()
Dim sTmp As String
Dim bChk As Boolean
With ActiveDocument
  sTmp = .FormFields(3).Result
  bChk = .FormFields(2).CheckBox.Value
  .Unprotect
  If sTmp = "a" Then
     .FormFields(2).Range.Font.Hidden = True
  Else
     .FormFields(2).Range.Font.Hidden = False
  End If
  .Protect wdAllowOnlyFormFields
  .FormFields(3).Result = sTmp
  .FormFields(2).CheckBox.Value = bChk
  MsgBox .FormFields(2).Result ' for testing
End With
End Sub

I don't think I'm an expert on formfields and forms.
If you have a close look, you'll notice,
that I didn't bother about formfields(1).

But if it helps, its alright.

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

 
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.