![]() |
|
#1
|
||||
|
||||
![]()
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
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
|||
|
|||
![]() Quote:
![]() The reason I am using a userform to get info that I populate into a combobox is simple, if not somewhat convoluted. Knowing the "Drawing Number" (which is the info the userform and the "combobox" focuses on) allows me to fill in about 30% of the rest of the form. However, the layout of the form is locked and I can't move the Drawing Number field to the top. It's currently near the bottom. By having them input it before the document opens ensures that the users won't waste time (and make errors) when inputting the data into the form. If you are asking why don't I just make the field a text field instead of a combobox it is because I am not skilled enough in VBA and/or XML or whatever method would allow me to store all the values linked to the "Drawing Number". Here is an example of the data that will be linked to a Drawing Number (each of these values have their own corresponding contentcontrol... Drawing Number --> Product Description, Rev Level, Material, Job Number, SN's required (which will show as a large check symbol and eventually I would like to make it show a small table where the serial numbers can be entered, otherwise that area would be hidden) If I was doing this in AHK it would be a breeze, but unfortunately I am bound by ISO standards in the creation of all forms for this company, so I have to make do with what I have (and my current knowledge level at the moment). I hope this clears up any confusion, or at the very least, not make it worse. ![]() Any suggestions, or pointing me in the right direction, you can offer has been and will continue to be, very appreciated. |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA ppt ComboBox behaivor: 1.OnFocus change value 2. get dropdownlist doesn't disappear after mousec | janism22 | PowerPoint | 2 | 03-26-2015 12:35 AM |
ActiveDocument.ContentControls(ID) not working | Tejas.T | Word VBA | 3 | 03-09-2015 06:50 PM |
Updating grouped ContentControls in Word 2010 | MGerhard | Word VBA | 3 | 08-04-2014 02:34 AM |
![]() |
ScottA | Excel Programming | 3 | 05-06-2014 12:49 PM |
XML parsing & Object variable not set (Error 91) | tinfanide | Excel Programming | 0 | 12-29-2011 08:43 AM |