View Single Post
 
Old 09-29-2015, 02:16 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

That code looks suspiciously like some I've posted here...

To work with multiple content controls, you could tag each of the output ones to match the titles of the ones you're using for the inputs, then use code like:
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim i As Long, StrDetails As String
With ContentControl
  Select Case .Title
    Case Is = "Choice1"
      For i = 1 To .DropdownListEntries.Count
        If .DropdownListEntries(i).Text = .Range.Text Then
          StrDetails = Replace(.DropdownListEntries(i).Value, "|", Chr(11))
          Exit For
        End If
      Next
      ActiveDocument.SelectContentControlsByTag("Choice1").Item(1).Range.Text = StrDetails
    Case Is = "Choice2"
      For i = 1 To .DropdownListEntries.Count
        If .DropdownListEntries(i).Text = .Range.Text Then
          StrDetails = Replace(.DropdownListEntries(i).Value, "|", Chr(11))
          Exit For
        End If
      Next
      ActiveDocument.SelectContentControlsByTag("Choice2").Item(1).Range.Text = StrDetails
    Case Else
  End Select
End With
End Sub
Note: You would really only need:
StrDetails = Replace(.DropdownListEntries(i).Value, "|", Chr(11))
if the output has multiple lines; otherwise you could use just:
StrDetails = .DropdownListEntries(i).Value
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote