Dropdown list

Copper Contributor

New to this.   I'm trying to use modern (not legacy) dropdown lists, which stores a friendly label, with an integer value.  On selection, another field will contain the summed-up values calculated from multiple dropdown lists.



2 Replies

@leejohnc You will need to use some visual basic code that runs the ContentControlOnExit event for each of the DropDown Content Controls to perform the additions.

You will find some hints on the Content Control pages on Greg Maxey's website at:







Yes, I was able to figure it out, thanks.  Not my finest work, but hopefully makes the point.


Screenshot_2024-04-03_at_6_00_19 PM.jpg








Private Sub Document_ContentControlOnEnter(ByVal ContentControl As ContentControl)

Dim doc As Document Set doc = ActiveDocument Dim dd As FormField Dim cc01As ContentControl
Dim Txt1 As FormField Dim TotalInt As Integer Dim oDLE As ContentControlListEntry
Dim Question01Answer As Integer

Set cc01 = doc.SelectContentControlsByTag("Question01").Item(1)

For Each oDLE In cc01.DropdownListEntries If oDLE.Text = cc01.Range.Text Then Question01Answer = oDLE.Value End If Next

Dim selectedValue As String TotalInt = Question01Answer

Set Txt1 = doc.FormFields("Text1")

Txt1.TextInput.Default = TotalInt 


End Sub