Hi there,
Name the Content Control you want populated with the same text, i.e. set the Title Property.
Then this should work, e.g. Using SalesRep as the Title Property
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim i As Long
Dim oC As ContentControl
With ContentControl
If .Title = "Client" Then
For i = 1 To .DropdownListEntries.Count
If .DropdownListEntries(i).Text = .Range.Text Then
ActiveDocument.SelectContentControlsByTitle("Phone ")(1).Range.Text = Split(.DropdownListEntries(i).Value, "|")(0)
ActiveDocument.SelectContentControlsByTitle("Fax") (1).Range.Text = Split(.DropdownListEntries(i).Value, "|")(1)
ActiveDocument.SelectContentControlsByTitle("Email ")(1).Range.Text = Split(.DropdownListEntries(i).Value, "|")(2)
For Each oC In ActiveDocument.ContentControls
If oC.Title = "SalesRep" Then
oC.Range.Text = .Range.Text
Exit For
End If
Set oC = Nothing
Next oC
Exit For
End If
Next
End If
End With
Set oC = Nothing
End Sub
|