View Single Post
 
Old 10-01-2013, 12:28 AM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,343
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I don't see where you've previously mentioned that the 'Value' column has anything other than the Display Name (default).

Getting values can be problematic if two or more have the same display names, as there's no vba for directly querying the displayed name's index #. Accordingly, one has to loop through all of them and compare the display name each against each list entry. Subject to that caveat, try:
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim StrOutput As String, CtrlID As String, i As Long
If ContentControl.Type <> wdContentControlDropdownList Then Exit Sub
For Each ContentControl In ContentControls
  With ContentControl
    If .Type = wdContentControlDropdownList Then
      If .Title = "Input" Then
        If .Range.Text <> .PlaceholderText Then
          For i = 1 To .DropdownListEntries.Count
            If .DropdownListEntries(i) = .Range.Text Then
              StrOutput = StrOutput & .DropdownListEntries(i).Value & "+"
            End If
          Next
        Else
          StrOutput = StrOutput & "N/A" & "+"
        End If
      End If
    End If
    If .Title = "Output" Then CtrlID = .ID
  End With
Next
StrOutput = Left(StrOutput, Len(StrOutput) - 1)
ContentControls(CtrlID).Range.Text = StrOutput
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote