Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-21-2017, 09:13 AM
Irimi-Ai Irimi-Ai is offline how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list Windows 7 32bit how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list Office 2013
Novice
how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list
 
Join Date: Apr 2017
Posts: 3
Irimi-Ai is on a distinguished road
Question how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list

Hi all,

First-time poster here, but have read a lot of posts that have gotten me pretty far. However, now I'm stumped. Need help with how to have portions of text (hereafter "sections") appear based on selection from a drop-down list. I can have sections appear by using nested {IF} statements and bookmarks, but can't get past 2 problems:

1) having the section text be hidden until referenced (i.e., document should look blank except for the drop-down box, and once a selection is made the rest of the text sections should appear)
2) retaining Cont. Ctrls. and formatting in the section text

I've seen ideas about these in other posts, but none of them seem to work for me based on enterprise-enforced MS Word restrictions in my work setting. Please see the limitations and strong preferences below:

Limitations:
-Only have access to Word 2013
-The "section" text must retain all formatting exactly (e.g., color-coding, indents, Cont. Ctrl. boxes, tables, etc.)
-The Cont. Ctrls. in the section text must remain functional and cannot be Legacy Forms or Active X.

Strong preferences:
-If at all possible, the section text should remain fully editable (no restricted editing)


-Avoid VBA. 1) I need to be able to make future revisions of the form, but know next to nothing about VBA. 2) In my work setting, VBA will likely be problematic.
-A Cont. Ctrl. drop-down for the initial drop-down (right now it's a Legacy in order to get the "Calculate on exit" function).

Those are preferences, so if the task requires breaking one of those preferences I would still like to know since I *may* be able to have this deployed in my work setting.

Last bit to consider: my work setting may be moving to Office 2016 within a year. Would the task be possible or more easily achieved in Word 2016?

I've attached a sample Word file for what I need (incl.Bookmarks, the drop-down, {IF} statements, etc.). The "A" and "B" text blocks should initially be hidden, but populate when matching selection is picked from the drop-down with all formatting intact and fully editable.

Thank you just for reading all this!!!
Attached Files
File Type: docx Sample.docx (23.6 KB, 48 views)
Reply With Quote
  #2  
Old 04-21-2017, 03:52 PM
Charles Kenyon Charles Kenyon is offline how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list Windows 10 how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Your task will be no easier in Word 2016.

I believe with Content Controls rather than legacy formfields vba will be required. It is possible that you could store than vba in distributed global templates rather than in particular templates. Essentially the vba is going to tell when the user changes the content control. Last I heard, there is no change event for content controls, but I may be out of date.

You might want to, instead, look into a UserForm.
Create a Simple Userform

Learn about styles and ability to limit styles in documents. Use those to control formatting.

Consider using AutoText or other building blocks for your text to be inserted.
Automated Boilerplate Using Microsoft Word

You should be using a template, not a document. This is true whether or not you are using vba. Templates in Microsoft Word

And no, you guessed right, this is not going to be a simple project to create or to implement.
Reply With Quote
  #3  
Old 04-21-2017, 05:16 PM
macropod's Avatar
macropod macropod is online now how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list Windows 7 64bit how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list 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

Quote:
Originally Posted by Irimi-Ai View Post
Need help with how to have portions of text (hereafter "sections") appear based on selection from a drop-down list. I can have sections appear by using nested {IF} statements and bookmarks, but can't get past 2 problems:

1) having the section text be hidden until referenced (i.e., document should look blank except for the drop-down box, and once a selection is made the rest of the text sections should appear)
2) retaining Cont. Ctrls. and formatting in the section text
That can be done via:
• the use of IF fields to conditionally show/hide the text;
• the use of 'hiiden' font formatting;
• using VBA to conditionally add/remove the content.
Quote:
Originally Posted by Irimi-Ai View Post
Limitations:
...-The Cont. Ctrls. in the section text must remain functional and cannot be Legacy Forms or Active X.

Strong preferences:
-If at all possible, the section text should remain fully editable (no restricted editing)
-Avoid VBA. 1) I need to be able to make future revisions of the form, but know next to nothing about VBA. 2) In my work setting, VBA will likely be problematic.
-A Cont. Ctrl. drop-down for the initial drop-down (right now it's a Legacy in order to get the "Calculate on exit" function).
Unless you use legacy formfields, you cannot avoid VBA. How much VBA would be required would depend on other factors - see below.
Quote:
Originally Posted by Irimi-Ai View Post
The "A" and "B" text blocks should initially be hidden, but populate when matching selection is picked from the drop-down with all formatting intact and fully editable.
Regardless of which approach you use, nothing will be 'fully editable' if the output is controlled by field coding, since field content is not editable in a meaningful way. Although the use of hidden text formatting might initially seem attractive, it is actually quite problematic, as you have no control over whether the end user would see text that is formatted as hidden or, even if it isn't, whether it would print; those setting are controlled by the user's Word setup.

Given your stipulations, it seems the only workable approach would be to use bookmarked ranges for where the conditional content is to go and to store that content, with all its formatting in an external document from where it can be copied into the 'main' document - use VBA code tied to the content control 'on exit' event. It also means having two documents and, if your users can't be guaranteed to have access to a common folder in which that document is stored, both would need to be kept in the same folder.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 04-21-2017, 06:10 PM
Charles Kenyon Charles Kenyon is offline how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list Windows 10 how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

See also: Create a Form Using Word Content Controls, and Word Content Controls.

You could create Mapped Dropdown Content Controls. perhaps using Greg Maxey's Content Control Tools. Then use them in IF Fields. This requires no bookmarks. While Greg's Content Control Tools does use vba, this would be used in the construction of the form, not in its use.

The thing is that you cannot reliably predict the updating of those IF fields. You would need to either do it with vba or train your users on how to do it manually. (Usually, it is not very hard.)

Note also that there is an inherent limitation in the size of an IF field. You could get around that by using AutoText fields in the results.

Again, a UserForm, perhaps stored in a Global Template, would probably be simpler. Yes, you would need to learn some vba; your users would not. The UserForm could be launched with a macro attached to a keyboard shortcut and/or a QAT button, both of which could be stored in that global template.
Reply With Quote
  #5  
Old 04-21-2017, 06:25 PM
macropod's Avatar
macropod macropod is online now how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list Windows 7 64bit how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list 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

Quote:
Originally Posted by Charles Kenyon View Post
Note also that there is an inherent limitation in the size of an IF field. You could get around that by using AutoText fields in the results.
That's much less an issue than the fact the displayed field content is not editable in a meaningful way. As soon as anything causes the filed to refresh (e.g. printing the document), the edits would disappear.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 04-25-2017, 09:31 AM
Irimi-Ai Irimi-Ai is offline how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list Windows 7 32bit how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list Office 2013
Novice
how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list
 
Join Date: Apr 2017
Posts: 3
Irimi-Ai is on a distinguished road
Thumbs up

Quote:
Originally Posted by macropod View Post
...the only workable approach would be to use bookmarked ranges for where the conditional content is to go and to store that content, with all its formatting in an external document from where it can be copied into the 'main' document - use VBA code tied to the content control 'on exit' event. It also means having two documents and, if your users can't be guaranteed to have access to a common folder in which that document is stored, both would need to be kept in the same folder.
That was it! I set up a reference ("master") file on a shared network drive (actually in a hidden folder with file properties set as "read-only" so less chance of it being tampered) and bookmarked the different sections/content. Then, in the separate template I used InsertFileRange to insert certain bookmarked ranges from the reference file depending on the selection in the Content Control drop-down. That was exactly what I needed...thanks for the guidance!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list Word VBA - "Page left Blank" between Sections to make all Sections start on even page Cov_ATC Word VBA 10 11-28-2021 03:41 PM
How to link a drop down list to certain sections/headings? Johnheng82 Word 0 02-22-2017 04:36 PM
Hide/Unhide Text Based on Drop Down Selection gw1500se Word 3 02-19-2015 12:17 PM
how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list Dynamically changing drop-down list based on selection? (Word Form) laurarem Word 1 02-21-2013 10:17 PM
how to make sections hidden/appear based on selection in Cont. Ctrl. Drop-down list Change cell color when selection is made from a drop down list fedcco Excel 12 08-28-2012 10:43 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:01 AM.


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