Page 1 of 1 |
vaifan1986
Posts: 4638
Location: Birthplace of the necktie.
|
Posted: Tue, 24th Jul 2018 16:02 Post subject: Cascade dropdown lists in MS Word |
|
 |
Not sure if right place to ask, but google is failing me.
Is it possible to create cascade droplists in Word where selecting an option in first droplist affects which options become available in the second one?
Micek:
i7 4790K @ 4.6GHz- Gigabyte Z97X-Gaming 3 - 980 WF3 \o/ - 16GB Corsair - WD 4TB - Mountain of SSDs - Dell UltraSharp U2414H 24''
|
|
Back to top |
|
 |
|
Posted: Tue, 24th Jul 2018 16:14 Post subject: |
|
 |
Does it have to be a word document?
|
|
Back to top |
|
 |
vaifan1986
Posts: 4638
Location: Birthplace of the necktie.
|
Posted: Tue, 24th Jul 2018 16:17 Post subject: |
|
 |
PumpAction wrote: | Does it have to be a word document? |
Unfortunately, yes.
Micek:
i7 4790K @ 4.6GHz- Gigabyte Z97X-Gaming 3 - 980 WF3 \o/ - 16GB Corsair - WD 4TB - Mountain of SSDs - Dell UltraSharp U2414H 24''
|
|
Back to top |
|
 |
|
Posted: Tue, 24th Jul 2018 18:16 Post subject: |
|
 |
Example:
https://i.imgur.com/lteP4j5.mp4
OK, this took some time, hope it works for you:
1. Go to Developer Tab (if not visible, right click ribbon and set a checkbox next to Developer
2. Create a new Combobox for Make
3. Go to Properties
4. Enter Tag "Make"
5. Add Options for Make
6. Repeat steps 2 - 4 for Model and Engine (with the appropriate tags "Model" and "Engine")
7. Add a simple text field
8. Enter Tag "Result" for it
--
Now click the Visual Basic button on your developer Tab and insert this code:
Code: |
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim doc As Document
Dim Make As ContentControl
Dim Model As ContentControl
Dim Engine As ContentControl
Dim Result As ContentControl
Set doc = ActiveDocument
Set Make = doc.SelectContentControlsByTag("Make")(1)
Set Model = doc.SelectContentControlsByTag("Model")(1)
Set Engine = doc.SelectContentControlsByTag("Engine")(1)
Set Result = doc.SelectContentControlsByTag("Result")(1)
Select Case ContentControl.Tag
Case "Make"
Model.DropdownListEntries.Clear
Model.Range.Text = ""
Engine.DropdownListEntries.Clear
Engine.Range.Text = ""
Select Case ContentControl.Range.Text
Case "BMW"
With Model.DropdownListEntries
.Add "3"
.Add "5"
End With
Case "Mercedes"
With Model.DropdownListEntries
.Add "C"
.Add "E"
End With
Case "Audi"
With Model.DropdownListEntries
.Add "A4"
.Add "A6"
End With
End Select
Case "Model"
Engine.DropdownListEntries.Clear
Engine.Range.Text = ""
Select Case ContentControl.Range.Text
Case "3"
With Engine.DropdownListEntries
.Add "318i"
.Add "320d"
.Add "335d"
End With
Case "5"
With Engine.DropdownListEntries
.Add "520i"
.Add "530d"
.Add "M540i"
End With
Case "C"
With Engine.DropdownListEntries
.Add "180"
.Add "200"
End With
Case "E"
With Engine.DropdownListEntries
.Add "250"
.Add "350CDI"
End With
Case "A4"
With Engine.DropdownListEntries
.Add "2.0TDI"
End With
Case "A6"
With Engine.DropdownListEntries
.Add "2.0TDI"
.Add "3.0TDI"
End With
End Select
Case "Engine"
Result.Range.Text = "Your Selection: " & Make.Range.Text & " " & Model.Range.Text & " " & Engine.Range.Text
End Select
End Sub
|
Done 
|
|
Back to top |
|
 |
|
Posted: Tue, 24th Jul 2018 19:33 Post subject: |
|
 |
Last edited by paxsali on Thu, 4th Jul 2024 23:26; edited 2 times in total
|
|
Back to top |
|
 |
|
Posted: Wed, 25th Jul 2018 10:17 Post subject: |
|
 |
|
|
Back to top |
|
 |
vaifan1986
Posts: 4638
Location: Birthplace of the necktie.
|
|
Back to top |
|
 |
|
Posted: Sat, 28th Jul 2018 18:28 Post subject: |
|
 |
Great, am happy for you men 
|
|
Back to top |
|
 |
Page 1 of 1 |
All times are GMT + 1 Hour |