?
Solved

Checkbox controlox

Posted on 2004-09-20
1
Medium Priority
?
207 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
[X]
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
1 Comment
 
LVL 11

Accepted Solution

by:
Steiner earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
Suggested Courses

770 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