Forum Discussion
Use "Value" Field from Drop-Down List Properties with a Combo Box Content Control
Thanks for the reply NikolinoDE
I have followed your steps 1-7, as this is exactly how I thought it should work and had already tried this, however the field does not populate with the Value, only the Display Name. See screen shots below. I have also captured the version of Word I am using incase this may be effecting it.
Any further ideas?
Version: Microsoft® Word for Microsoft 365 MSO (Version 2304 Build 16.0.16327.20200) 64-bit
Use the following steps:
Open your Word document and navigate to the Developer tab. If you don't see the Developer tab in the ribbon, you'll need to enable it first. Go to "File" > "Options" > "Customize Ribbon" and check the box next to "Developer" in the right-hand column. Then click "OK."
In the Developer tab, click on the "Design Mode" button in the Controls group to enable design mode.
Click on the Combo Box Content Control button in the Controls group to insert a combo box into your document.
Right-click on the combo box and choose "Properties" from the context menu.
In the Content Control Properties dialog box, go to the "Dropdown List Properties" tab.
In the "Display Name" column, enter the full names of the persons (e.g., "John Smith" or "Mary Jones") and in the "Value" column, enter their corresponding initials (e.g., "JS" or "MJ"). You can add multiple items by clicking the "Add" button.
Click "OK" to close the Content Control Properties dialog box.
Click on the "Design Mode" button again to disable design mode.
Now, when users interact with the combo box, they will see the full names in the drop-down list, but once they make a selection, only the initials will populate the field.
Please note that these instructions are based on the version of Word you mentioned (Microsoft 365 MSO, Version 2304, Build 16.0.16327.20200). The steps may vary slightly if you are using a different version of Word.
- RobertOliverNZMay 24, 2023Copper Contributor
I have followed these steps exactly and still no luck. Please see attached video or a screen recording of me carrying out these steps. See below link for this.
- NikolinoDEMay 24, 2023Gold Contributor
I apologize for the confusion. Achieving the desired functionality without using VBA is not possible in Word with the version you mentioned (Microsoft 365 MSO, Version 2304, Build 16.0.16327.20200). The functionality to dynamically populate a field with the initials based on a selected item from a combo box drop-down list requires the use of VBA.
Here are all the steps how you can do it:
- Open your Word document and navigate to the Developer tab. If you don't see the Developer tab in the ribbon, you'll need to enable it first. Go to "File" > "Options" > "Customize Ribbon" and check the box next to "Developer" in the right-hand column. Then click "OK."
- In the Developer tab, click on the "Design Mode" button in the Controls group to enable design mode.
- Click on the Combo Box Content Control button in the Controls group to insert a combo box into your document.
- Right-click on the combo box and choose "Properties" from the context menu.
- In the Content Control Properties dialog box, go to the "Dropdown List Properties" tab.
- In the "Display Name" column, enter the full names of the persons (e.g., "John Smith" or "Mary Jones") and in the "Value" column, enter their corresponding initials (e.g., "JS" or "MJ"). You can add multiple items by clicking the "Add" button.
- Click "OK" to close the Content Control Properties dialog box.
- Double-click on the combo box to open the VBA editor.
- In the VBA editor, paste the following code:
Private Sub ComboBox1_Change() Dim fullName As String Dim initials As String fullName = ComboBox1.Text initials = GetInitials(fullName) ActiveDocument.SelectContentControlsByTitle("ComboBox1").Item(1).Range.Text = initials End Sub Function GetInitials(fullName As String) As String Dim nameParts() As String Dim i As Integer nameParts = Split(fullName) GetInitials = "" For i = LBound(nameParts) To UBound(nameParts) GetInitials = GetInitials & Left(nameParts(i), 1) Next i End Function​
10. Close VBA Editor.
Now, when users select a person's full name from the combo box, the field will be populated with the corresponding initials.
That these instructions are based on the version of Word you mentioned (Microsoft 365 MSO, Version 2304, Build 16.0.16327.20200).
I hope that all misunderstandings have been cleared up and that the instructions will be successful in your plans .
- briannabangDec 07, 2023Copper ContributorHello - I need help with the same thing, however, my display names are different locations and the value needs to be their addresses. Can you help with this?