PDA

View Full Version : content control in userform



chubbychub
02-22-2019, 09:01 PM
hi, I want to know if its possible to have a userform drop down list, and based on what the drop down list user picks, to autofill a field text or automatically fill in the corresponding text.
for example, lets say,i pick the contractor from the dropdown list, and it will automatically pull the contractors drivers license number. Is this possible? please point to the right directions.

gmayor
02-22-2019, 09:37 PM
The short answer to your question is yes. If you store the relevant details in a worksheet, you can use a function to read the worksheet into your combo or list box e.g. see https://www.gmayor.com/Userform_ComboBox.html. Then use the values in the hidden columns to fill a bookmark or better still write to a content control.

chubbychub
02-23-2019, 03:33 AM
that is exactly what I was looking for, is there a tutorial to do each of those steps? and instead of having the button "signature" could I just add it into a commandbutton_click, I already have bookmarks, and other macros. Thank you.

gmayor
02-23-2019, 05:11 AM
The web page provides the function code to read a worksheet into a list/combo box. The following when modified to suit what you have will write the columns from the combo box/list box to content controls by their titles e.g.


Dim oCC As ContentControl
For Each oCC In ActiveDocument.ContentControls
Select Case oCC.TITLE
Case "Title 1"
oCC.Range.Text = comboboxname.Column(1)
Case "Title 2"
oCC.Range.Text = comboboxname.Column(2)
'etc
End Select
Next oCC

chubbychub
03-03-2019, 05:05 PM
I have been working at it and trying to modify things for my needs, where do I change the tab that says "user form test" and below it has signatur button? (where do I change that) ? thank in advance

chubbychub
03-03-2019, 05:25 PM
please look at email I sent via your website. thank you.

gmayor
03-03-2019, 10:07 PM
I have replied :)

chubbychub
03-05-2019, 06:44 PM
where do I change the add-in from the 'tab' (userform test) to something else? The part were is above the signature.