View Single Post
 
Old 10-26-2015, 03:23 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Try:
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim i As Long, StrDetails As String
With ContentControl
  If .Title = "Client" Then
    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
    With ActiveDocument
      .SelectContentControlsByTitle("ClientAddress").Item(1).Range.Text = StrDetails
      If StrDetails <> " " Then StrDetails = _
      .SelectContentControlsByTitle("Client").Item(1).Range.Text & Chr(11) & StrDetails 
      .SelectContentControlsByTitle("ClientDetails").Item(1).Range.Text = StrDetails
    End With
  End If
End With
End Sub
Note that the above code assumes:
1. The dropdown (and any other ordinary control requiring only the client name) is titled 'Client';
2. Every content control requiring just the client address is titled 'ClientAddress'; and
3. Every content control requiring the client name & address is titled 'ClientDetails'.
Where you have multiple copies of any of these content controls to update, just refer to each by its index #, remembering to update all those with 'ClientAddress' before updating any with 'ClientDetails'.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote