#1
|
|||
|
|||
Combobox recursive
Hi to All, I have this file attached: doc1_v7.docm in which for semplicity i have created 3 couple of combos ... in real time I can have 8 couples of Combos, twice related In VBA code inside the file, the functions are the same ... My goal is to create a loop in which I can compact the functions because I don' t want to repeat the same instructions many times ... Is it possible in some way ? Thanks a lot in advance !! |
#2
|
||||
|
||||
If you use content controls, you won't need any code to populate the primary dropdowns. Then you'll only need code to secondary dropdowns. See attached.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thanks a lot macropod, for your precious help !!!!
I' ve seen the file sent to me and i 've tried to simulate a real situation: with my surprise I saw that up to now, even with your fantastic code, i' ve the problem choosing the option in the different 8 couples of menus. I' ve copied with Ctrl+C Ctrl+V a line and i' ve increased the number of Region and Locale in the Property settings of menus ... I don't understand this problem of choosing, because any couple is now indipendent ... Here there is the file modified: Thanks a lot in advance !!! doc1_v8.docm |
#4
|
||||
|
||||
Try the attached revision. Note the incrementing Locale tags.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Hi macropod, fantastic code !!!
Now the couples of menus work perfectly well !!! Before closing the post I' ve the last thing to ask ... In our activity in these days arrived the request if it' s possible to show in the Word file only the first couple line of menus; in this case, if the client has the necessity can push an icon button "plus" to show the second line with the second couple of menus an so on ... In these days I' ve found a solution that doesn' t contain an incon button "plus". I have selected all the lines, from 2 to 8, and I used Format Hidden to hide them. In case the client wants to show another couple of menus (to insert new values from different countries) must do Ctrl+A, remove the flag on Format / Hidden and selected again the lines from 3 to 8 (for example) hiding them I think that this is not the best, but with my experience I' m not able to insert a function in an icon button "plus" to show another line .... Ideas to solve the problem ?? Thanks a lot in advance !!!!! |
#6
|
||||
|
||||
It's far simpler to start of with the max sets, then just delete the unwanted ones than to add them programmatically. Something could be done programmatically using a table (see, for example, https://www.msofficeforums.com/word-...html#post87989). As you'll see, the code for that is quite complex.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Thanks macropod,
I' ve inserted the code of table of the past topic to see how it works, but i' m not able to use it ... Where i make mistake ? Thanks a lot again !! doc1_v9.docm |
#8
|
||||
|
||||
You can't just insert the code from the other thread - it has to be significantly re-written to work with your document - after you've changed the document layout to use a table instead of just using paragraphs.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
Hi macropod, yes, sure, i' ve seen that the code is relative to a table, infact i' ve created a table inside the document (the last posted) to create a similar situation ....
|
#10
|
||||
|
||||
As I also said, the code:
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#11
|
|||
|
|||
Ok, thanks a lot for all !!!
|
#12
|
|||
|
|||
Sorry for the disturb,
but i' ve seen a limitation in the use of characters... Today i put in production the file menu_multiplo.docm but i' ve seen that all the array elements are truncated to 255 chars. I have this kind of lists: AFRICA: |Algeria|Angola|Benin|Botswana|British Indian Ocean Territory|Burkina Faso|Burundi|Cameroon|Cape Verde|Central African Republic|Chad|Comoros|Congo|Cote D'Ivoire|Democratic Republic Of Congo|Djibouti|Egypt|Equatorial Guinea|Eritrea|Ethiopia|Gabon|Gambia|Ghana|Guinea| Guinea-Bissau|Kenya|Lesotho|Liberia|Libya|Madagascar|Mala wi|Mali|Mauritania|Mauritius|Mayotte|Morocco|Mozam bique|Namibia|Niger|Nigeria|Reunion|Rwanda|Sao Tome And Principe|Senegal|Seychelles|Sierra Leone|Somalia|South Africa|South Sudan|Sudan|Swaziland|Tanzania|Togo|Tunisia|Uganda |Western Sahara|Zambia|Zimbabwe AMERICA |Anguilla|Antigua And Barbuda|Argentina|Bahamas|Barbados|Belize|Bermuda| Bolivia|Brazil|British Virgin Islands|Canada|Cayman Islands|Chile|Colombia|Costa Rica|Cuba|Curaçao|Dominica|Dominican Republic|Ecuador|El Salvador|Falkland Islands|French Guiana|Greenland|Grenada|Guadeloupe|Guatemala|Guya na|Haiti|Honduras|Jamaica|Martinique|Mexico|Montse rrat|Netherlands Antilles|Nicaragua|Panama|Paraguay|Peru|Puerto Rico|Saint Lucia|Saint Vincent And The Grenadines|Suriname|Trinidad And Tobago|Turks And Caicos Islands|U.S. Virgin Islands|United States|Uruguay|Venezuela ecc... and the others continents when in the file word i create a new element in the menù called "Region", with Ctrl+C Ctrl+V i' ve copied for example the values of AFRICA but are truncated in Gha (the first part of Ghana) if i insert a new element AMERICA, the values are truncated in Greenl (the first part of Greenland) Is there a way to solve this kind of limitation ? Thanks in advance !!! |
#13
|
||||
|
||||
Try the attached. The 'Locale' data are now in the VBA code.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#14
|
|||
|
|||
Fantastic !! It works perfectly !!!
Thanks a lot again !!! |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Get available Printers within a combobox | hhorber | Word VBA | 0 | 04-04-2018 02:21 AM |
Combobox | dweekley | Excel | 3 | 05-25-2017 05:41 AM |
Recursive animation | Oscemc | PowerPoint | 0 | 01-22-2014 08:11 AM |
ComboBox ListIndex = -1 even though it does NOT = -1 | Joe Patrick | Word VBA | 0 | 08-03-2011 08:34 AM |
Combobox manipulation | vsempoux | Word VBA | 3 | 10-31-2009 08:58 AM |