Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-28-2019, 02:39 AM
il_betto il_betto is offline Combobox recursive Windows 10 Combobox recursive Office 2010
Novice
Combobox recursive
 
Join Date: May 2019
Posts: 10
il_betto is on a distinguished road
Default 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 !!
Reply With Quote
  #2  
Old 05-28-2019, 04:21 AM
macropod's Avatar
macropod macropod is online now Combobox recursive Windows 7 64bit Combobox recursive 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

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.
Attached Files
File Type: docm doc1_v7 (1).docm (34.1 KB, 15 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-28-2019, 05:38 AM
il_betto il_betto is offline Combobox recursive Windows 10 Combobox recursive Office 2010
Novice
Combobox recursive
 
Join Date: May 2019
Posts: 10
il_betto is on a distinguished road
Default

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
Reply With Quote
  #4  
Old 05-28-2019, 05:04 PM
macropod's Avatar
macropod macropod is online now Combobox recursive Windows 7 64bit Combobox recursive 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

Try the attached revision. Note the incrementing Locale tags.
Attached Files
File Type: docm doc1_v8 (1).docm (38.4 KB, 13 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 05-29-2019, 02:08 AM
il_betto il_betto is offline Combobox recursive Windows 10 Combobox recursive Office 2010
Novice
Combobox recursive
 
Join Date: May 2019
Posts: 10
il_betto is on a distinguished road
Default

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 !!!!!
Reply With Quote
  #6  
Old 05-29-2019, 02:40 AM
macropod's Avatar
macropod macropod is online now Combobox recursive Windows 7 64bit Combobox recursive 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

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]
Reply With Quote
  #7  
Old 05-29-2019, 03:23 AM
il_betto il_betto is offline Combobox recursive Windows 10 Combobox recursive Office 2010
Novice
Combobox recursive
 
Join Date: May 2019
Posts: 10
il_betto is on a distinguished road
Default

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
Reply With Quote
  #8  
Old 05-29-2019, 03:30 AM
macropod's Avatar
macropod macropod is online now Combobox recursive Windows 7 64bit Combobox recursive 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 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]
Reply With Quote
  #9  
Old 05-29-2019, 05:34 AM
il_betto il_betto is offline Combobox recursive Windows 10 Combobox recursive Office 2010
Novice
Combobox recursive
 
Join Date: May 2019
Posts: 10
il_betto is on a distinguished road
Default

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 ....
Reply With Quote
  #10  
Old 05-29-2019, 03:08 PM
macropod's Avatar
macropod macropod is online now Combobox recursive Windows 7 64bit Combobox recursive 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

As I also said, the code:
Quote:
has to be significantly re-written to work with your document
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 05-29-2019, 11:57 PM
il_betto il_betto is offline Combobox recursive Windows 10 Combobox recursive Office 2010
Novice
Combobox recursive
 
Join Date: May 2019
Posts: 10
il_betto is on a distinguished road
Default

Ok, thanks a lot for all !!!
Reply With Quote
  #12  
Old 06-04-2019, 03:19 AM
il_betto il_betto is offline Combobox recursive Windows 10 Combobox recursive Office 2010
Novice
Combobox recursive
 
Join Date: May 2019
Posts: 10
il_betto is on a distinguished road
Default

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 !!!
Reply With Quote
  #13  
Old 06-04-2019, 04:16 AM
macropod's Avatar
macropod macropod is online now Combobox recursive Windows 7 64bit Combobox recursive 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

Try the attached. The 'Locale' data are now in the VBA code.
Attached Files
File Type: docm doc1_v8 (2).docm (41.6 KB, 14 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #14  
Old 06-04-2019, 05:40 AM
il_betto il_betto is offline Combobox recursive Windows 10 Combobox recursive Office 2010
Novice
Combobox recursive
 
Join Date: May 2019
Posts: 10
il_betto is on a distinguished road
Default

Fantastic !! It works perfectly !!!

Thanks a lot again !!!
Reply With Quote
Reply

Thread Tools
Display Modes


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 recursive Combobox manipulation vsempoux Word VBA 3 10-31-2009 08:58 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:00 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