Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 04-02-2016, 03:27 PM
macropod's Avatar
macropod macropod is offline Multiple Dependant Drop Down Fields Windows 7 64bit Multiple Dependant Drop Down Fields Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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
 

Tags
multi drop down



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Dependant Drop Down Fields Inserting certain text dependant on a drop down box value JakeLRL Word VBA 1 03-31-2016 07:37 PM
Multiple Dependant Drop Down Fields 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

Other Forums: Access Forums

All times are GMT -7. The time now is 02:52 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft