View Single Post
 
Old 03-07-2016, 01:56 AM
highrise955 highrise955 is offline Windows 10 Office 2013
Advanced Beginner
 
Join Date: Mar 2016
Posts: 37
highrise955 is on a distinguished road
Default Dropdownlist-Parsing values to various ContentControls

Hi All!

I have a combobox with multiple entries on my template. Each entry has multiple values separated by the "|" symbol. When the template loads, a userform pops up asking the user to type in a number. That number is then put into the combobox in my document. I then want the various values for the combobox entry (assuming they typed in a number that is listed in the combobox) to be placed into various contentcontrols in my document.

I know how to do it if the entry has only ONE value but I'm a little confused with multiple values. Here is the code I am currently using to act on just ONE value for an unrelated action...

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
  ActiveDocument.ContentControls(2).Range.Text = StrDetails
  End If
End With
End Sub
I hope I am explaining this correctly.
Reply With Quote