![]() |
|
#2
|
||||
|
||||
|
Your third dropdown seems unnecessary, since there are no options to choose from. Accordingly, all you need there is a text content control.
Now, suppose you have two dropdowns, one titled 'Master' and the other titled 'Servant', plus a text content control titled 'Slave'. If you add your 'Outlet 1' & 'Outlet 2' dropdown options to the 'Master', the following macro, added to your document's 'ThisDocument' code module, will take care of the updating: Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim i As Long, StrOut As String
With ContentControl
If .Title = "Master" Then
Select Case .Range.Text
Case "Outlet 1"
StrOut = "010,020,030"
Case "Outlet 2"
StrOut = "S010,S020,S030"
Case Else
StrOut = ""
End Select
With ActiveDocument.SelectContentControlsByTitle("Servant")(1)
.Type = wdContentControlText
.Range.Text = ""
.Type = wdContentControlDropdownList
For i = 0 To UBound(Split(StrOut, ","))
.DropdownListEntries.Add Split(StrOut, ",")(i)
Next
End With
ActiveDocument.SelectContentControlsByTitle("Slave")(1).Range.Text = " "
End If
If .Title = "Servant" Then
Select Case .Range.Text
Case "010"
StrOut = "A1234"
Case "020"
StrOut = "11112"
Case "030"
StrOut = "Z7890"
Case "S010"
StrOut = "A7654"
Case "S020"
StrOut = "S41114"
Case "S030"
StrOut = "S44444"
Case Else
StrOut = " "
End Select
ActiveDocument.SelectContentControlsByTitle("Slave")(1).Range.Text = StrOut
End If
End With
End Sub
FWIW, the above is just an extension of the example given in this post: https://www.msofficeforums.com/word-...html#post77762
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
| Tags |
| multi drop down |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Inserting certain text dependant on a drop down box value
|
JakeLRL | Word VBA | 1 | 03-31-2016 07:37 PM |
copy row into new sheet dependant on cell data
|
scorpain | Excel | 1 | 03-08-2016 02:37 PM |
| Drag & Drop between fields is sketchy? | johnlondon | Outlook | 1 | 03-26-2014 03:31 AM |
| Data dependant on checkboxes? | ryanf | Word | 2 | 11-01-2012 05:00 AM |
| Merge fields & Drop down menu's | ShadeTree | Word | 0 | 03-09-2010 08:19 AM |