Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-03-2023, 02:02 AM
Ikeg Ikeg is offline Word VBA nested fields show based on checkbox Windows 11 Word VBA nested fields show based on checkbox Office 2021
Novice
Word VBA nested fields show based on checkbox
 
Join Date: Aug 2023
Posts: 3
Ikeg is on a distinguished road
Default Word VBA nested fields show based on checkbox

Hi,



I got the following code from this forum.
Now i have nested fields end everytime i check a checkbox in a nestedfield it auto unchecks again.

Is it possible to have nested fields that show based on a checkboxes?

For example.
Checkbox 1 checked = Show table with content. In that table there are some questions and another checkbox (Checkbox 2) if checked it will show extra content.

Code:
Option Explicit
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Dim Val As Long

With CCtrl
  Select Case .Title
    Case "Checkbox1", "Checkbox2", "Checkbox3", "Checkbox4", "Checkbox5", "Checkbox6", "Checkbox7", "Checkbox8":
        ActiveDocument.CustomDocumentProperties("Chk" & Right(.Title, 1)).Value = (.Checked = True) ^ 2
        ActiveDocument.Fields.Update
  End Select
End With
End Sub
Thanks in advance!
Reply With Quote
 

Tags
fields, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word VBA nested fields show based on checkbox Nested Fields using Conga for Salesforce new user Mail Merge 5 12-15-2022 04:02 PM
Show/Delete paragraph based on checkbox status mahaabub Word VBA 1 05-13-2019 05:33 PM
VBA in Word 2010 to show certain text only when a YES checkbox is checked kdsim Word VBA 0 05-16-2018 05:16 AM
Bookmark will not show/hide based on CC Checkbox lord_kaiser Word VBA 1 04-17-2018 01:19 AM
Word VBA nested fields show based on checkbox Show/Hide Text based on Checkbox Selection tammytran105 Word VBA 7 10-02-2014 04:30 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft