View Single Post
 
Old 11-03-2017, 08:31 AM
FionaMcKenzie FionaMcKenzie is offline Windows 10 Office 2016
Novice
 
Join Date: Oct 2017
Location: Surrey, United Kingdom
Posts: 14
FionaMcKenzie is on a distinguished road
Default

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
Reply With Quote