![]() |
#34
|
||||
|
||||
![]()
For someone who is 'kinda new to macros' and speaks multiple languages you have done a remarkable job with the code. Well done.
However you haven't explained particularly well your actual question with regards to a third level. You also didn't post a sample document so we can't see what your structure might be for that third level. I've looked at the code you provided and decided that it is needlessly repetitive and can be streamlined to make things clearer. So I created a sample doc and set up some loops to achieve what I think your code was already doing in a less repetitive way. This makes use of both the Title and Tag properties of the CCs so that groups of related CCs can be looped through in the code. If this aligns with your actual document, then perhaps you can post a sample document and explain more clearly what the third level should do when the second level is changed. I suspect it can be even more streamlined if your document is setup with Repeating Sections which is what it appears you are trying to do. This is the code I adapted from your posted code so that it works with a document with CCs set up with both Tag and Title attributes. Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean) Application.ScreenUpdating = False Dim i As Long, StrOut As String, aCC As ContentControl, arrOut() As String With CCtrl If .Tag = "Trigger" 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 arrOut = Split(StrOut, ";") For Each aCC In ActiveDocument.SelectContentControlsByTag(CCtrl.Title) aCC.DropdownListEntries.Clear aCC.DropdownListEntries.Add .PlaceholderText aCC.Type = wdContentControlText aCC.Range.Text = "" aCC.Type = wdContentControlDropdownList If Not CCtrl.ShowingPlaceholderText Then For i = 0 To UBound(arrOut) aCC.DropdownListEntries.Add arrOut(i) Next End If Next aCC End If End With Application.ScreenUpdating = True End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
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 |