View Single Post
 
Old 03-07-2016, 03:21 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,363
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

Perhaps you could explain why you're using a userform to solicit data that then gets input into "into the combobox in my document." The code is designed for direct input into a dropdown content control, not for indirect input into a combobox content control. Indirect input means the content control's 'on exit' event never fires, so you'd have to add code to do that as well.

As for the "multiple values separated by the "|" symbol," what are you trying to do with them? The code you're using was written around the idea that all the output would go into a single text content control, with line breaks between the values. If you want the various values separated by the "|" symbol to be output to different text content controls, rather different code would be needed. For example:
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
    For i = 0 To UBound(Split(StrDetails, "|"))
      ActiveDocument.SelectContentControlsByTitle("Value" & i)(1).Range.Text = Split(StrDetails, "|")(i)
    Next
  End If
End With
End Sub
where the output content controls are titled 'Value0' - 'Value#', where # is the number assigned to the last control to be updated.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote