#1
|
|||
|
|||
Help with Cascading Dropdown List
Hi
When I modified the defined list in "Master" and "Slave" list in https://www.msofficeforums.com/word-...down-list.html to include about 9 options and associated 1 to 9 different slave options, the drop down list is not working anymore. Can you please help? I pasting what I did: Code:
Option Explicit Dim StrOption As String Private Sub Document_ContentControlOnEnter(ByVal CCtrl As ContentControl) If CCtrl.Title = "Master" Then StrOption = CCtrl.Range.Text End Sub Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean) Application.ScreenUpdating = False Dim i As Long, StrOut As String With CCtrl If .Title = "Master" Then If StrOption = .Range.Text Then Exit Sub Select Case .Range.Text Case "Design" StrOut = "Inadequate Design,Incorrect design methodology" Case "Communication" StrOut = "No communication,Ineffective communication,Wrong message provided,Misunderstanding/misinterpreting message,Lack of/Awaiting on required information" Case "Plant and Equipment" StrOut = "Wrong plant/equipment used,Non compatible plant/equipment used" Case "Planning" StrOut = "Inadequate resource planning,Inadequate scope planning,Inadequate time planning" Case "Error/Violation" StrOut = "Poor workmanship,Non-compliance with plant/equipment's O&MM recommendations,Lack of supervision,Non-compliance with work methodology,Non-compliance with specification/acceptance criteria,Non-compliance with documented procedure/process,Unexpected Machine/Equipment Operational Failure,Operator Error,Operator lack of experience/competency/skill" Case "Materials Availability and Suitability or Quality of Material" StrOut = "Using non-approved material,Poor quality material,Defective material used" Case "Congestion/Restriction/Access" StrOut = "Inadequate space,Restrictions in place,Inadequate access" Case "ITP/Process Control" StrOut = "Lack of adoption of ITP control,Non-compliance with an ITP control" Case "Abnormal operational situation/condition" StrOut = "Inclement Weather Condition" Case "Document Control Management" StrOut = "Using superseded document,Non-availability of IFU document" Case "Subcontractor Management" StrOut = "Requirement not communicated to subcontractor,Lack of supervision on site" Case Else .Type = wdContentControlText .Range.Text = "" .Type = wdContentControlDropdownList End Select With ActiveDocument.SelectContentControlsByTitle("Slave")(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 Application.ScreenUpdating = True End Sub Last edited by macropod; 06-10-2019 at 09:48 PM. Reason: Added code tags |
#2
|
||||
|
||||
It works for me. See attached.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Macro not working in my drop down list
Hi Paul
Thank you for your response. Can you please look into the attached why it is not working? is it related to the format because the cells are horizontal? Thank you for your time. |
#4
|
||||
|
||||
There is no code in your attachment...
In any event, if you're going to have multiple 'master' and 'slave' content controls, you'll need to change the way you reference them in order to maintain the correct relationships between them.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Thanks Paul
I have fixed (by adding) the code. Can you please help how should I change the way they are referenced? Thanks Abdel |
#6
|
||||
|
||||
See attached.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Thank you, you are a legend!
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with cascading dropdown list | SaraO | Word VBA | 45 | 02-05-2023 05:33 PM |
The same cascading dropdown lists several times in a document | al9512 | Word VBA | 1 | 08-10-2018 04:42 AM |
Use the Same Cascading Dropdown Info Multiple Times | Inger70 | Word VBA | 2 | 08-10-2018 04:41 AM |
A Userform and 4 Cascading List Boxes | TheSwede | Excel | 3 | 04-02-2017 01:27 PM |
Linking WORD Cascading Dropdown Boxes to Excel | music_al | Word VBA | 6 | 02-15-2016 03:56 PM |