Cascade dropdown lists in MS Word
Page 1 of 1
vaifan1986




Posts: 4638
Location: Birthplace of the necktie.
PostPosted: 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
PumpAction
[Schmadmin]



Posts: 26759

PostPosted: Tue, 24th Jul 2018 16:14    Post subject:
Does it have to be a word document?


=> NFOrce GIF plugin <= - Ryzen 3800X, 16GB DDR4-3200, Sapphire 5700XT Pulse
Back to top
vaifan1986




Posts: 4638
Location: Birthplace of the necktie.
PostPosted: 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
PumpAction
[Schmadmin]



Posts: 26759

PostPosted: 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 Smile


=> NFOrce GIF plugin <= - Ryzen 3800X, 16GB DDR4-3200, Sapphire 5700XT Pulse
Back to top
paxsali
Banned



Posts: 18352

PostPosted: 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
PumpAction
[Schmadmin]



Posts: 26759

PostPosted: Wed, 25th Jul 2018 10:17    Post subject:
So, did it help men?


=> NFOrce GIF plugin <= - Ryzen 3800X, 16GB DDR4-3200, Sapphire 5700XT Pulse
Back to top
vaifan1986




Posts: 4638
Location: Birthplace of the necktie.
PostPosted: Sat, 28th Jul 2018 06:57    Post subject:
Yes, it fucking did. Tried it yesterday, modified a bit to suit my needs an hey presto Very Happy
Thanks Sir Pumpy Very Happy


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
PumpAction
[Schmadmin]



Posts: 26759

PostPosted: Sat, 28th Jul 2018 18:28    Post subject:
Great, am happy for you men Very Happy


=> NFOrce GIF plugin <= - Ryzen 3800X, 16GB DDR4-3200, Sapphire 5700XT Pulse
Back to top
Page 1 of 1 All times are GMT + 1 Hour
NFOHump.com Forum Index - Applications
Signature/Avatar nuking: none (can be changed in your profile)  


Display posts from previous:   

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group