Solved

Checkbox controlox

Posted on 2004-09-20
1
205 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 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Do you ever need to create a 20 page Word document for some testing purpose? Are you tired of copying & pasting old boring "lorem ipsum" text over and over again, increasing font size and line space in order to make the document 20+ pages long? Look…
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…
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…
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 …

739 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