Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-06-2017, 12:58 PM
nathan.gray@emerson.com nathan.gray@emerson.com is offline Hide/Show text based upon check box status Windows 7 64bit Hide/Show text based upon check box status Office 2016
Novice
Hide/Show text based upon check box status
 
Join Date: May 2017
Posts: 6
nathan.gray@emerson.com is on a distinguished road
Default Hide/Show text based upon check box status

I have been looking through the 2 forum posts at the bottom of this post and can't seem to get a working product.



Attached is a file with my attempt. It seems that checking the box won't update the custom document property. I might have the custom doc prop set up wrong?

Also, is there any way to set it up such that when the checkbox is selected an entire section of text shows/hides. This way you could keep formatting such as bulleting.

My overall goal is to have various check boxes at the top of the document that would then hide/show appropriate lines/sections in the following document.

Any help would be greatly appreciated.


https://www.excelforum.com/word-prog...show-text.html
https://windowssecrets.com/forums/sh...BA-Word-Macros
Attached Files
File Type: docm Test CheckBox.docm (28.3 KB, 91 views)
Reply With Quote
  #2  
Old 12-06-2017, 01:44 PM
macropod's Avatar
macropod macropod is offline Hide/Show text based upon check box status Windows 7 64bit Hide/Show text based upon check box status Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The basic problem with your code is that it isn't in the document's 'ThisDocument' code module; you've placed it in an ordinary code module instead.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 12-06-2017, 02:31 PM
nathan.gray@emerson.com nathan.gray@emerson.com is offline Hide/Show text based upon check box status Windows 7 64bit Hide/Show text based upon check box status Office 2016
Novice
Hide/Show text based upon check box status
 
Join Date: May 2017
Posts: 6
nathan.gray@emerson.com is on a distinguished road
Default

Awesome that worked! I am a mechanical engineer by trade so I'm not super strong on coding, although I try.

Might you have a suggestion for how to make formatting like bullet points be carried along with the text?

And any suggestions on how to hide an entire block of text or a specific section?
Reply With Quote
  #4  
Old 12-06-2017, 02:43 PM
macropod's Avatar
macropod macropod is offline Hide/Show text based upon check box status Windows 7 64bit Hide/Show text based upon check box status Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The conditional output text can contain multiple paragraphs, textboxes, pictures, tables, etc., with whatever formatting you require. It's all just a matter of inserting that content between the double-quotes in the IF field. The only things that are liable to create problems are the use of auto-numbered paragraphs, SEQ fields and footnotes/endnotes; most users don't have those as conditional content, though.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 12-08-2017, 10:57 AM
nathan.gray@emerson.com nathan.gray@emerson.com is offline Hide/Show text based upon check box status Windows 7 64bit Hide/Show text based upon check box status Office 2016
Novice
Hide/Show text based upon check box status
 
Join Date: May 2017
Posts: 6
nathan.gray@emerson.com is on a distinguished road
Default

Is there any trick to putting Content Controls in the double quotes?

I put CheckBox2 into a quoted area controlled by CheckBox1. CB2 controls a different quoted area. It functions but CB2 continues to be filled with an X no matter the state.

I did the bullet point issue figured out. It seems that bullet points wont show if you only dont have any characters in front of the bullet. Maybe there is some way to code the bullet point to avoid this error?

thanks in advanced,

Nate
Attached Images
File Type: jpg Capture.JPG (24.1 KB, 82 views)
Reply With Quote
  #6  
Old 12-08-2017, 01:08 PM
macropod's Avatar
macropod macropod is offline Hide/Show text based upon check box status Windows 7 64bit Hide/Show text based upon check box status Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You can't output active formfields, content controls or ActiveX controls that way. Since they're inside a field code, they can only display whatever state they were set up with.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
checkbox, vba

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide/Show text based upon check box status How to use checkbox to show/hide bookmarked text? namrehx Word VBA 16 12-14-2017 01:45 PM
Hide/Unhide Text Based on Drop Down Selection gw1500se Word 3 02-19-2015 12:17 PM
Show/hide text macro and security issues? subspace3 Word VBA 1 10-05-2014 10:05 AM
Hide/Show text based upon check box status Show/Hide Text based on Checkbox Selection tammytran105 Word VBA 7 10-02-2014 04:30 PM
Hide/Show text based upon check box status Show/hide paragraphs based on upfront decisions miscia76 Word 1 11-13-2013 04:29 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:12 PM.


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