Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-31-2019, 08:40 AM
gmaxey gmaxey is offline Muliple entries in Multiple dropdown lists Windows 10 Muliple entries in Multiple dropdown lists Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

I'm assuming you are referring to Paul's file posted back at the start of that thread.

There Paul uses a content control titled "Client" and another titled "ClientDetails." However, as the document contains only two CCs, he didn't use the title of the second in his code.

The CC used for the list of clients is a Content Control dropdown list. The one used to display the associated details can be a plain or rich text control.

The code goes in the ThisDocument module of the VB Project and can be modified as follows to add additional pairs:

Code:
Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean)
Dim lngIndex As Long, strDetails As String
  With CC
    Select Case .Title
      Case "Client"
        For lngIndex = 1 To .DropdownListEntries.Count
          If .DropdownListEntries(lngIndex).Text = .Range.Text Then
            strDetails = Replace(.DropdownListEntries(lngIndex).Value, "|", Chr(11))
            Exit For
          End If
        Next
        ActiveDocument.SelectContentControlsByTitle("ClientDetails").Item(1).Range.Text = strDetails
     Case "Dogs"
        For lngIndex = 1 To .DropdownListEntries.Count
          If .DropdownListEntries(lngIndex).Text = .Range.Text Then
            strDetails = Replace(.DropdownListEntries(lngIndex).Value, "|", Chr(11))
            Exit For
          End If
        Next
        ActiveDocument.SelectContentControlsByTitle("DogDetails").Item(1).Range.Text = strDetails
     End Select
  End With
End Sub
So lets assume you want to add a pair that deals with dogs and their characteristics.

Insert a dropdown CC and title it "Dogs" as you add the type of dogs to the list, put the breed in the Display as Field and the characteristics in the Value fields each separated using "|"


Eg:


Display As Value
Beagle Friendly|Loyal|Playful
Pug Ugly|flat faced


Insert the plain text CC and title is DogDetails.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Muliple entries in Multiple dropdown lists Multiple entries in dropdown lists paul_pearson Word VBA 151 10-18-2023 04:23 PM
Help with Dropdown Lists Gerardo G Word VBA 1 06-18-2015 11:10 PM
Dropdown Lists in Excel 2010 janehoss Excel 0 12-01-2014 07:16 AM
Muliple entries in Multiple dropdown lists VBA Dropdown change list Entries automatically QA_Compliance_Advisor Word VBA 20 09-16-2014 07:29 AM
Word Forms : Dropdown lists wferaera45 Word 0 04-06-2006 03:02 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:31 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