Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-12-2022, 03:07 AM
gmaxey gmaxey is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,598
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Paul,


This is a very long thread. Perhaps I've shared this with you before but not sure. Have you considered mapping the two controls in your example file (post #2). If you do, your code is reduced to:




Code:
Private Sub Document_ContentControlBeforeContentUpdate(ByVal ContentControl As ContentControl, Content As String)
  With ContentControl
    If .Title = "Client" Then
      .XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:ClientDetails[1]").Text = _
        Replace(.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:Client[1]").Text, "|", vbCr)
    End If
  End With
lbl_Exit:
  Exit Sub
End Sub

with no requirement to exit the Client CC
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #2  
Old 07-17-2023, 10:20 PM
Atzhel Atzhel is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2019
Novice
 
Join Date: Mar 2023
Location: Peru
Posts: 4
Atzhel is on a distinguished road
Default

Hi, I'm kinda new to macros on word. So, I managed to do a two-level dependent dropdown list with contentcontrol boxes. I want to make third level but this one is autopopulated. I saw the method with values, but because it's a dependent dropdown list there are no values for the second level. I've looked through all posts on this thread but it seems there's no answer for what I need.

I would really be thankful if someone can help me.

This is the code I've got so far, what I want is that after I select the second dropdown another control content box gets filled on its own with a set value.

Let's say I select
Quote:
Obtiene información de textos orales
from

Code:
 Case "Se comunica oralmente en inglés como lengua extranjera"
        StrOut = "Obtiene información de textos orales;Infiere e interpreta información de textos orales;Adecúa, organiza y desarrolla las ideas de forma coherente y cohesionada;Utiliza recursos no verbales y paraverbales de forma estratégica;Interactúa estratégicamente con distintos interlocutores;Reflexiona y evalúa la forma, el contenido y el contexto del texto oral"
then I want a controlcontent box to automatically populate with a set text.

Code:
Option Explicit
Dim StrOption As String

Private Sub Document_ContentControlOnEnter(ByVal CCtrl As ContentControl)
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 = "Competencias" Then
    If StrOption = .Range.Text Then Exit Sub
    Select Case .Range.Text
      Case "Se comunica oralmente en inglés como lengua extranjera"
        StrOut = "Obtiene información de textos orales;Infiere e interpreta información de textos orales;Adecúa, organiza y desarrolla las ideas de forma coherente y cohesionada;Utiliza recursos no verbales y paraverbales de forma estratégica;Interactúa estratégicamente con distintos interlocutores;Reflexiona y evalúa la forma, el contenido y el contexto del texto oral"
      Case "Lee diversos tipos de textos en inglés como lengua extranjera"
        StrOut = "Obtiene información del texto escrito;Infiere e interpreta información del texto escrito;Reflexiona y evalúa la forma, el contenido y contexto del texto"
      Case "Escribe diversos tipos de textos en inglés como lengua extranjera"
        StrOut = "Adecúa el texto a la situación comunicativa;Organiza y desarrolla las ideas de forma coherente y cohesionada;Utiliza convenciones del lenguaje escrito de forma pertinente;Reflexiona y evalúa la forma, el contenido y contexto del texto escrito"
      Case Else
        .Type = wdContentControlText
        .Range.Text = ""
        .Type = wdContentControlDropdownList
    End Select
    With ActiveDocument.SelectContentControlsByTitle("Capacidades")(1)
      .DropdownListEntries.Clear
      .DropdownListEntries.Add .PlaceholderText
      For i = 0 To UBound(Split(StrOut, ";"))
        .DropdownListEntries.Add Split(StrOut, ";")(i)
      Next
      .Type = wdContentControlText
      .Range.Text = ""
      .Type = wdContentControlDropdownList
    End With
    With ActiveDocument.SelectContentControlsByTitle("Capacidades2")(1)
      .DropdownListEntries.Clear
      .DropdownListEntries.Add .PlaceholderText
      For i = 0 To UBound(Split(StrOut, ";"))
        .DropdownListEntries.Add Split(StrOut, ";")(i)
      Next
      .Type = wdContentControlText
      .Range.Text = ""
      .Type = wdContentControlDropdownList
    End With
    With ActiveDocument.SelectContentControlsByTitle("Capacidades3")(1)
      .DropdownListEntries.Clear
      .DropdownListEntries.Add .PlaceholderText
      For i = 0 To UBound(Split(StrOut, ";"))
        .DropdownListEntries.Add Split(StrOut, ";")(i)
      Next
      .Type = wdContentControlText
      .Range.Text = ""
      .Type = wdContentControlDropdownList
    End With
    With ActiveDocument.SelectContentControlsByTitle("Capacidades4")(1)
      .DropdownListEntries.Clear
      .DropdownListEntries.Add .PlaceholderText
      For i = 0 To UBound(Split(StrOut, ";"))
        .DropdownListEntries.Add Split(StrOut, ";")(i)
      Next
      .Type = wdContentControlText
      .Range.Text = ""
      .Type = wdContentControlDropdownList
    End With
  End If
  If .Title = "Competencias2" Then
    If StrOption = .Range.Text Then Exit Sub
    Select Case .Range.Text
      Case "Se comunica oralmente en inglés como lengua extranjera"
        StrOut = "Obtiene información de textos orales;Infiere e interpreta información de textos orales;Adecúa, organiza y desarrolla las ideas de forma coherente y cohesionada;Utiliza recursos no verbales y paraverbales de forma estratégica;Interactúa estratégicamente con distintos interlocutores;Reflexiona y evalúa la forma, el contenido y el contexto del texto oral"
      Case "Lee diversos tipos de textos en inglés como lengua extranjera"
        StrOut = "Obtiene información del texto escrito;Infiere e interpreta información del texto escrito;Reflexiona y evalúa la forma, el contenido y contexto del texto"
      Case "Escribe diversos tipos de textos en inglés como lengua extranjera"
        StrOut = "Adecúa el texto a la situación comunicativa;Organiza y desarrolla las ideas de forma coherente y cohesionada;Utiliza convenciones del lenguaje escrito de forma pertinente;Reflexiona y evalúa la forma, el contenido y contexto del texto escrito"
      Case Else
        .Type = wdContentControlText
        .Range.Text = ""
        .Type = wdContentControlDropdownList
    End Select
    With ActiveDocument.SelectContentControlsByTitle("Capacidades5")(1)
      .DropdownListEntries.Clear
      .DropdownListEntries.Add .PlaceholderText
      For i = 0 To UBound(Split(StrOut, ";"))
        .DropdownListEntries.Add Split(StrOut, ";")(i)
      Next
      .Type = wdContentControlText
      .Range.Text = ""
      .Type = wdContentControlDropdownList
    End With
    With ActiveDocument.SelectContentControlsByTitle("Capacidades6")(1)
      .DropdownListEntries.Clear
      .DropdownListEntries.Add .PlaceholderText
      For i = 0 To UBound(Split(StrOut, ";"))
        .DropdownListEntries.Add Split(StrOut, ";")(i)
      Next
      .Type = wdContentControlText
      .Range.Text = ""
      .Type = wdContentControlDropdownList
    End With
    With ActiveDocument.SelectContentControlsByTitle("Capacidades7")(1)
      .DropdownListEntries.Clear
      .DropdownListEntries.Add .PlaceholderText
      For i = 0 To UBound(Split(StrOut, ";"))
        .DropdownListEntries.Add Split(StrOut, ";")(i)
      Next
      .Type = wdContentControlText
      .Range.Text = ""
      .Type = wdContentControlDropdownList
    End With
    With ActiveDocument.SelectContentControlsByTitle("Capacidades8")(1)
      .DropdownListEntries.Clear
      .DropdownListEntries.Add .PlaceholderText
      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
Sorry if the message is too long or I go around the topic too many times, I'm no expert at programming and I want to be as clear as possible. Again, thank you in advance for any response.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple entries in dropdown lists Delete Multiple Entries dudeabides Office 1 07-04-2011 02:49 AM
Multiple task lists and multiple calendars kballing Outlook 0 01-18-2011 10:23 AM
Creating Multiple Contact Lists meltee78 Outlook 1 01-03-2011 09:45 PM
multiple calendar entries across a group halfhearted Outlook 0 10-11-2009 12:13 PM
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 09:25 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