View Single Post
 
Old 09-29-2020, 02:49 PM
Charles Kenyon Charles Kenyon is offline Windows 10 Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

And, based on Paul's response to another question, here is a function:


Code:
Function CCValue(ccMyContentControl As ContentControl) As String
    ' Charles Kenyon 29 September 2020
    '
    ' Function based on Paul Edstein's Code
    ' https://stackoverflow.com/questions/58809271/how-to-get-dropdown-value-not-display-text-from-word-content-control-using-vba
    '
    If ccMyContentControl.Type <> wdContentControlDropdownList Then
        If ccMyContentControl.Type <> wdContentControlComboBox Then
            CCValue = ccMyContentControl.range.Text
            Exit Function
        End If
    End If
    Dim i As Long
    With ccMyContentControl
        For i = 1 To .DropdownListEntries.Count
            If .DropdownListEntries(i).Text = .range.Text Then _
                CCValue = .DropdownListEntries(i).Value
        Next i
    End With
End Function
Reply With Quote