View Single Post
 
Old 03-07-2016, 02:55 AM
highrise955 highrise955 is offline Windows 10 Office 2013
Advanced Beginner
 
Join Date: Mar 2016
Posts: 37
highrise955 is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Perhaps you should study the thread your code was lifted from more closely: https://www.msofficeforums.com/word-...own-lists.html

I did and I was thinking the following code in post #33 of that thread might be what I am looking for...

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
But I just can't seem to understand how to direct the different values to the various contentcontrols. I'm sure it's staring at me right in the face but I'm just not getting it.

For example, let's say the user types in the number 4444-333-55555.

And that number in the combobox (named: "Drawing Number") has the following values:

Laser Assembly RH|Steel, Polycarb|Rev N

I want the first value to go to a contentcontrol named "Product Description" and the second value to go to a contrentcontrol named "Material" and so on...

Thanks for any input you can offer.
Reply With Quote