Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Checkbox controlox

Posted on 2004-09-20
1
200 Views
Last Modified: 2011-10-03
Hello, I have two checkboxes on my word document, how do i get it to when the second checkbox is clicked by the user  textbox5 will appear and allow the user to type in data. If checkbox1 is click then hide textbox5.
0
Comment
Question by:sandramac
1 Comment
 
LVL 11

Accepted Solution

by:
Steiner earned 500 total points
ID: 12109442
Unfortunately you don't have a possibility to react on a click, but you can do this when the user leaves a checkbox. I assume that checkbox1 and 2 can't be checked at the same time? The try this, insert this code into a module:

Sub LeaveCheckBox1()
   If ActiveDocument.FormFields("Checkbox1").CheckBox.Value = True Then
      ActiveDocument.FormFields("Checkbox2").CheckBox.Value = False
      ActiveDocument.Unprotect
      ActiveDocument.FormFields("Textbox5").Range.Font.Hidden = True
      ActiveDocument.Protect wdAllowOnlyFormFields, True
   End If
End Sub

Sub LeaveCheckBox2()
   If ActiveDocument.FormFields("Checkbox2").CheckBox.Value = True Then
      ActiveDocument.FormFields("Checkbox1").CheckBox.Value = False
      ActiveDocument.Unprotect
      ActiveDocument.FormFields("Textbox5").Range.Font.Hidden = False
      ActiveDocument.Protect wdAllowOnlyFormFields, True
   End If
End Sub

Please not that the document protection has no password set in this example, if you want to have a password you'll need to add that to the 2 subs, too, as they need to unprotect the document in order to set the hidden property.

You check the properties of your 2 checkboxes and add a call to LeaveCheckBox1 as exit macro for the first checkbox and do the same thing for the 2nd one.

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Like many others, we try and discourage users from printing documents unnecessarily and instead send or share them electronically. However, this doesn't always work and documents are still printed. With this simple solution, if the user tries to …
Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question