Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word VBA

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 02-05-2015, 08:12 AM
SaraO SaraO is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Feb 2015
Posts: 1
SaraO is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 02-05-2015, 02:36 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,353
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

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.
Attached Files
File Type: docm Content Controls - Dependent Dropdown.docm (39.0 KB, 121 views)
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 01-04-2016, 11:02 AM
nvstrien nvstrien is offline Windows 10 Office 2013
Novice
 
Join Date: Jan 2016
Posts: 1
nvstrien is on a distinguished road
Default 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
Reply With Quote
  #4  
Old 01-04-2016, 04:23 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,353
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

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
[MS MVP - Word]
Reply With Quote
  #5  
Old 11-09-2016, 09:16 PM
jeweldarby jeweldarby is offline Windows 8 Office 2010 32bit
Novice
 
Join Date: Sep 2015
Posts: 2
jeweldarby is on a distinguished road
Default

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.
Reply With Quote
  #6  
Old 11-09-2016, 09:32 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,353
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

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
[MS MVP - Word]
Reply With Quote
  #7  
Old 11-10-2016, 07:54 AM
jeweldarby jeweldarby is offline Windows 8 Office 2010 32bit
Novice
 
Join Date: Sep 2015
Posts: 2
jeweldarby is on a distinguished road
Default

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!
Reply With Quote
  #8  
Old 11-10-2016, 01:47 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,353
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

The placeholder text is built-in, but you can change it. See: http://gregmaxey.com/word_tip_pages/...lder_text.html
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #9  
Old 07-26-2017, 08:53 PM
vic2rp vic2rp is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jul 2017
Posts: 1
vic2rp is on a distinguished road
Default

I'm so greatful for this solution. I've been scouring the internet for two days and I finally found this. Thank you macropod.
Reply With Quote
Reply
Please reply to this thread with any new information or opinions.

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


All times are GMT -7. The time now is 02:34 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft