![]() |
|
#6
|
||||
|
||||
|
If your table has 5 columns throughout, you could use:
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 = .DropdownListEntries(i).Value
Exit For
End If
Next
With ActiveDocument.Tables(5).Range
For i = 0 To 14
.Cells(i + 11).Range.Text = Split(StrDetails, "|")(i)
Next
End With
End If
End With
End Sub
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 = .DropdownListEntries(i).Value
Exit For
End If
Next
With ActiveDocument.Tables(5)
For i = 0 To 4
.Rows(3).Cells(i + 1).Range.Text = Split(StrDetails, "|")(i)
Next
For i = 5 To 9
.Rows(4).Cells(i - 4).Range.Text = Split(StrDetails, "|")(i)
Next
For i = 10 To 14
.Rows(5).Cells(i - 9).Range.Text = Split(StrDetails, "|")(i)
Next
End With
End If
End With
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Move to next content control
|
cksm4 | Word VBA | 13 | 07-02-2019 07:48 PM |
Clicking the selected Content Control checkbox returns wrong control in vba event
|
DougsGraphics | Word VBA | 2 | 06-24-2015 07:31 AM |
Deleting a table from a content control -- preserving the content control
|
BrainSlugs83 | Word Tables | 8 | 11-14-2013 03:06 AM |
Hierarchical content control
|
ntjson | Word VBA | 1 | 04-04-2013 12:07 AM |
Content control titles
|
jillapass | Word VBA | 3 | 05-29-2012 06:11 AM |