![]() |
|
#6
|
||||
|
||||
|
Using the document in the second link as an example, what I'd suggest for the replication is to have a text content control titled:
• 'Client' anywhere you want the client name replicated; and • 'ClientDetails' anywhere you want the client details replicated, coupled with the ContentControlOnExit macro re-coded as: Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
Dim i As Long, StrDetails As String
With CCtrl
If .Title = "Client" Then
If .Type <> wdContentControlDropdownList Then Exit Sub
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("Client")
For i = 2 To .Count
If CCtrl.Range.Text = CCtrl.PlaceholderText Then
.Item(i).Range.Text = ""
Else
.Item(i).Range.Text = CCtrl.Range.Text
End If
Next
End With
With ActiveDocument.SelectContentControlsByTitle("ClientDetails")
For i = 1 To .Count
.Item(i).Range.Text = StrDetails
Next
End With
End If
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Auto Populate Text On Dependent Drop Down Exit
|
GregStewartPTC | Word VBA | 2 | 02-27-2017 05:37 AM |
How to populate dependent dropdowns and auto-fill text fields simultaneously?
|
vera | Word VBA | 1 | 10-07-2016 07:41 PM |
| VBA coding for multiple drop-down lists to populate a text box for each list | yeatropulo | Word VBA | 14 | 11-11-2015 01:08 PM |
| auto populate fields for multiple files w/in folder | jbyrd | Word | 0 | 07-21-2014 07:35 AM |
| Auto populate text | help i'm stuck! | Word | 1 | 08-13-2010 11:52 AM |