#1
|
|||
|
|||
Fill in part of form based on checkbox state
Hi,
Is the same result possible with a checkbox instead of a formfield. If yes, can you please guide me. Thanks Quote:
Moderator Note: Split from this thread. |
#2
|
||||
|
||||
Quote:
In any event, it's hard to see how you would propose to make that work if the user checks two or more checkboxes.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
I put your question into its own thread since it is really a different question even if related. Please let us know what kind of checkbox you are using. (Word has three kinds of active checkboxes.)
|
#4
|
|||
|
|||
Hi Paul,
I have posted the question on your other post. But unfortunately it got moved or removed. The document in the #1 post has help me a little. But when I am creating a second Checkbox2 its not working. Second is it possible to allow user to only select one checkbox only. Can you please guide me and explain in details, how to get it worked. Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean) Application.ScreenUpdating = False With ContentControl Select Case .Title Case "CheckBox1" If .Checked = True Then ActiveDocument.CustomDocumentProperties("Chk1").Value = 1 Else ActiveDocument.CustomDocumentProperties("Chk1").Value = 0 End If Case "CheckBox2" If .Checked = True Then ActiveDocument.CustomDocumentProperties("Chk2").Value = 1 Else ActiveDocument.CustomDocumentProperties("Chk2").Value = 0 End If Case Else End Select End With Application.ActiveWindow.View.ShowFieldCodes = False Application.Options.PrintFieldCodes = False ActiveDocument.Fields.Update Application.ScreenUpdating = True End Sub Last edited by bil_san1; 10-12-2022 at 01:11 PM. |
#5
|
|||
|
|||
Quote:
I want multiple checkboxes so the user can select any 1 checkbox only and a text field populates according to the selection. If you can provide the code with some explanation. So I can play with it for understanding. It would be a great help. |
#6
|
||||
|
||||
Can you provide an example document showing the checkbox and the text fields and what needs to be in those fields when the user checks the checkbox?
What do you want to happen if they subsequently uncheck the checkbox?
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#7
|
|||
|
|||
Quote:
There are 2 checkboxes. First checkbox is working fine but the second checkbox is not giving any output. If they select the checkbox certain output text will appear and on unchecking that text will disappear. Second question is it possible that they can only check one box at a time. File is attached |
#8
|
||||
|
||||
Your code relies on there being two Custom Document Properties in the document - Chk1 and Chk2. Only Chk1 exists in your attachment.
It is far from clear as to why you would want two checkboxes, as clicking any checkbox one or more times will toggle its checked state on/off each time. Nevertheless, I've added the Chk2 Custom Document Property and revised the code so that only one checkbox can be checked.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
Thank you so much
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Duplicating a set of form fields in a fill-able form | ChuckT | Word | 1 | 02-10-2021 08:07 PM |
Form auto fill based on a different field value. | stct | Word | 26 | 06-15-2019 04:08 PM |
Formula needed. If I write a specific name then I want the corresponding part number to fill | kmurph | Excel | 1 | 11-28-2018 12:02 AM |
Assigning Currency values to checkbox with sum presented as part of paragraph | Edwords | Word VBA | 24 | 07-24-2018 03:50 AM |
Date auto-populates based on checkbox | mcarter9000 | Word VBA | 5 | 12-23-2010 12:39 PM |