![]() |
#25
|
||||
|
||||
![]()
You cannot simply duplicate the code as you have done. For example, you can have only one instance of:
Code:
Option Explicit Dim StrOption As String Code:
Option Explicit Dim StrOption As String Private Sub Document_ContentControlOnEnter(ByVal CCtrl As ContentControl) With CCtrl Select Case .Title Case "Spouse", "Minor": StrOption = .Range.Text End Select End With 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 = "Spouse" Then If StrOption = .Range.Text Then Exit Sub Select Case .Range.Text Case "Yes" StrOut = "Spouse is able and available,Spouse is able and partially available,Spouse is able but not available,Spouse is available but not able,Spouse is IHSS Recipient,Other" Case "No" StrOut = "N/A" Case Else .Type = wdContentControlText .Range.Text = "" .Type = wdContentControlDropdownList End Select With ActiveDocument.SelectContentControlsByTitle("A&A")(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 If .Title = "Minor" Then If StrOption = .Range.Text Then Exit Sub Select Case .Range.Text Case "Yes", "Recipient is not a minor" StrOut = "N/A" Case "No" StrOut = "Parent is prevented from full-time employment due to child's needs, Recipient is under the care of a legal guardian" Case Else .Type = wdContentControlText .Range.Text = "" .Type = wdContentControlDropdownList End Select With ActiveDocument.SelectContentControlsByTitle("MinorExp")(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
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dropdown list, Macro | shield5 | Excel Programming | 7 | 10-27-2013 01:51 AM |
VBA: How to place dropdown list next to text | YigalB | Word VBA | 0 | 08-11-2013 01:48 PM |
block selection in dropdown list | Intruder | Excel | 2 | 01-10-2013 10:20 AM |
![]() |
r_p_t_0 | Word | 2 | 12-18-2012 05:55 AM |
Dropdown list of email addresses | J Partridge | Outlook | 1 | 01-13-2011 06:37 AM |