View Single Post
 
Old 04-02-2016, 03:27 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,359
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

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
Naturally, you'll want to edit the code to change the outputs generated by the 'Servant'.

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]
Reply With Quote