Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-11-2022, 01:27 AM
Basse Basse is offline Checkbox - toggle hide/unhide other checkboxes and their texts Windows 10 Checkbox - toggle hide/unhide other checkboxes and their texts Office 2021
Novice
Checkbox - toggle hide/unhide other checkboxes and their texts
 
Join Date: May 2022
Posts: 4
Basse is on a distinguished road
Question Checkbox - toggle hide/unhide other checkboxes and their texts

Hello,
I am new to VBA and I'm trying to create an document with 3 checkboxes, where each of them shows a specific text when checked, I managed this with bookmarking the text. But I would also like to hide the other 2 checkboxes when one checkbox is checked, is this possible? And I would also like them to appear again if I uncheck the box.

Here is the VBA code I've used so far, I also attach the document:

Private Sub CheckBox1_Click()
ClickEvent CheckBox1
End Sub

Private Sub CheckBox2_Click()


ClickEvent CheckBox2
End Sub

Private Sub CheckBox3_Click()
ClickEvent CheckBox3
End Sub


Private Sub ClickEvent(ctrl As msforms.CheckBox)
Dim sBookmarkName As String

With ThisDocument
Select Case ctrl.Name
Case "CheckBox1": sBookmarkName = "TextToHide"
Case "CheckBox2": sBookmarkName = "TextToHide2"
Case "CheckBox3": sBookmarkName = "TextToHide3"
End Select

.Bookmarks(sBookmarkName).Range.Font.Hidden = _
Not ctrl.Value
End With
End Sub
Attached Files
File Type: docm checkboxes VBA .docm (25.0 KB, 9 views)
Reply With Quote
 

Tags
checkbox, hide, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox - toggle hide/unhide other checkbox - XMLMapping GErl Word VBA 9 11-19-2020 03:15 PM
Toggle Collapse/Expand via Content Control Checkbox metaflowdesigns Word VBA 5 07-08-2020 02:53 PM
Checkbox - toggle hide/unhide other checkboxes and their texts Hide and Unhide Rows If.... Marcia Excel Programming 2 03-20-2020 07:25 PM
Checkbox - toggle hide/unhide other checkboxes and their texts Hide / unhide Rows NullVBA Excel Programming 4 12-09-2015 05:10 AM
Hide/Unhide pictures maloneb PowerPoint 1 01-18-2012 03:34 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:40 AM.


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