Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-07-2020, 02:22 AM
mbews mbews is offline Can Select Case be used to defined the Value of an item in a drop down list? Windows 10 Can Select Case be used to defined the Value of an item in a drop down list? Office 2019
Novice
Can Select Case be used to defined the Value of an item in a drop down list?
 
Join Date: Oct 2020
Posts: 6
mbews is on a distinguished road
Default Can Select Case be used to defined the Value of an item in a drop down list?

Hi folks,



I've been piecing together some code from a lot of the helpful resources on here as I'm trying to make more efficient form templates for the company I've recently joined. So far I have a drop down CC from which the Team Leader for any given site visit can be picked. Once this is chosen, their respective mobile number populates a Rich Text CC adjacent (In the drop down properties, TL name is set as Display Name, mobile number is set as Value). Additionally, I currently have, per the code below, a way that the specific Senior Operative(s) for each Team Leader populate a second drop down CC below (this is important as there will be a large quantity of Senior Ops in the finished code, saves people scrolling through them all).

Code:
With CCtrl
  If .Title = "TLName" Then
    If StrOption = .Range.Text Then Exit Sub
    Select Case .Range.Text
      Case "Alan B"
        StrOut = "Kenneth J"
      Case "Alan T"
        StrOut = "Colin L"
      Case Else
        .Type = wdContentControlText
        .Range.Text = ""
        .Type = wdContentControlDropdownList
    End Select
    With ActiveDocument.SelectContentControlsByTitle("SOName")(1)
      .DropdownListEntries.Clear
      For i = 0 To UBound(Split(StrOut, ","))
        .DropdownListEntries.Add Split(StrOut, ",")(i)
      Next
      .Type = wdContentControlText
      .Range.Text = ""
      .Type = wdContentControlDropdownList
    End With
  End If
End With
My issue is that this code defines the SO name as both the Display Name and Value whereas I would like to implement the same method to retrieve the SO mobile number as I did with the Team Leaders. Is there a way the Value can be defined independently of the Display Name, or a simpler way this could be done in general? If need be, I can provide a simplified copy of the template with the code in its entirety (I omitted this as there are other parts of the code irrelevant to this query).

Any help would be greatly appreciated.

Thanks,

Michael
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto create new worksheet when select option from drop down list JANET JONG Excel Programming 1 08-01-2018 07:13 AM
Select multiple items from a drop down list ConfuddledOne Excel Programming 0 01-30-2017 08:13 PM
Returning a specific value when item is selected from a drop-down list J Press Excel 4 09-10-2012 06:12 AM
Show the first item of a drop-down list instead of a blank Pragabhava Excel 1 12-29-2011 11:48 PM
Can Select Case be used to defined the Value of an item in a drop down list? Automatically select first item in drop-down? flackend Excel 4 08-29-2011 02:07 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:14 PM.


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