#1
|
|||
|
|||
Help with cascading dropdown list
I'm learning about all the great features MS Word offers. I am working on a template where I have a cascading dropdown that depends on the choice made in the first list. The list of items for the second dropdown is pretty long. I can't seem to figure out how to make this work. Any help or suggestions would be greatly appreciated.
|
#2
|
||||
|
||||
See the attached. The update process for the second dropdown is controlled by a ContentControlOnExit macro, which you can see by pressing Alt-F11. The conditional text for each dependent option is held as comma-delimited strings in the 'StrOut' variable populated by the 'Select Case' statement.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
cascading events not working anymore
Hi - I downloaded the example yesterday and then it worked fine. I created my own cascading dropdowns (three levels) and those worked fine too.... up to the moment I saved them and closed word. Now the ContentControlOnExit event is not noticed and even the unchanged code example that can be downloaded here does not work anymore. Any clues how to enable the trigger event.
This seems a related post: http://stackoverflow.com/questions/5...-on-a-template but I do not understand it. Thanks for any help you might be able to provide. _____Update____ If I enable all macros - it works fine... but I didn't do that yesterday so why did it work to begin with... Last edited by nvstrien; 01-04-2016 at 11:08 AM. Reason: found the solution |
#4
|
||||
|
||||
When you add a macro to a new or existing document that doesn't already have them, Word assumes you want to enable macros in that document. When you save said document, it must be saved in the macro-enabled format (docm - or dotm for a template) and, when re-opened, you must enable macros. One way of doing that without getting the 'enable macros' prompt is to save the document/template in a trusted location.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Thank you for this.
In the code I see these lines: .Type = wdContentControlText .Range.Text = "" .Type = wdContentControlDropdownList Can I find documentation on the "wd" format commands somewhere - again, I searched but cannot find this. Thank you for any help you can offer. |
#6
|
||||
|
||||
Regarding the 'wd' parameters, there are probably thousands of them. Which parameters apply in a given situation depends on what's appropriate to the method, property, etc. For the ContentControl.Type Property, see the WdContentControlType Enumeration in the Word VBA help file.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Thank you for the tip on wdContentControlType enumeration in the VBA ref. I did find a few examples that clarified things for me.
One question: Where does the text "Choose an item." for the placeholder text (PHT) come from? I would like to be able to control what appears as PHT. For example, if I choose Option 2 from the Master, I'd like to set the PHT to "Select an Element". Thank you so much for your help! |
#8
|
||||
|
||||
The placeholder text is built-in, but you can change it. See: http://gregmaxey.com/word_tip_pages/...lder_text.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
I'm so greatful for this solution. I've been scouring the internet for two days and I finally found this. Thank you macropod.
|
#10
|
|||
|
|||
Three dropdowns
Hello nvstrien,
can you upload the file with the three Dropdowns? I Need it with thre Dropdowns too. Thx Toni |
#11
|
|||
|
|||
Hi all,
Were any of you able to get three drop-down menus? I am struggling to have three dependent dropdowns, and would really appreciate if someone had a file to share. Thanks David |
#12
|
||||
|
||||
Adding more levels of dependent dropdowns is really just a case of extending the logic. See attached.
The 'A' example extends the logic to two dependencies. The content controls in this code are titled 'Master', 'Servant' and 'Slave'. You can use other titles, provided you make the corresponding changes to the VBA code. The 'B' example makes it simpler to add multiple additional dependencies. Being more generalized, the 'B' code requires you to specify how many levels there are - see note at the top of the VBA code. The content controls in this code are titled 'Level 0' through 'Level 3'. You can change 'Level' to any other single word without changing the VBA code. A space must remain between the text and level number, however.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#13
|
|||
|
|||
Paul,
Thank you so much for your quick reply, it is very helpful. Best wishes, David |
#14
|
|||
|
|||
My only other question is how I could have it that in my last dropdown, I could select multiple options. Is this possible?
What I am trying to design is for lesson planning purposes. I have attached what I am talking about. I appreciate any help. Thanks, David My Planning Tool 3 Cascade.docm |
#15
|
||||
|
||||
You cannot select multiple items in a dropdown. However, you could use yet another content control to display items previously selected. See attached. Note that the 'Selections' content control lists the previously-selected items in the order in which they were selected, not in the order they appear in the 'Progression Steps' content control. Accordingly, you'll need to select the items in the reverse of the order in which you want them listed - or you could relocate the 'Selections' content control above the 'Progression Steps' content control.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dropdown list, Macro | shield5 | Excel Programming | 7 | 10-27-2013 01:51 AM |
VBA: How to place dropdown list next to text | YigalB | Word VBA | 0 | 08-11-2013 01:48 PM |
block selection in dropdown list | Intruder | Excel | 2 | 01-10-2013 10:20 AM |
dropdown list for documents | r_p_t_0 | Word | 2 | 12-18-2012 05:55 AM |
Dropdown list of email addresses | J Partridge | Outlook | 1 | 01-13-2011 06:37 AM |