Greg,
I tried the code and based on what you had, I assumed I had to put the "Title" of every box that I was associating the original code with as a Case since you used the title Demo1. Now I get a Run-time error '6124' that says I'm not allowed to edit this selection because it is protected. Yes, I enabled protection to Form Only, to test for how a user will interact. No, the box locking contents from being edited is not checked. This is what I did:
Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Dim oDLE As ContentControlListEntry
With CCtrl
Select Case .Title
Case "Address"
For Each oDLE In .DropdownListEntries
If oDLE.Text = .Range.Text Then
.Range.Text = oDLE.Value
Exit For
End If
Next oDLE
Case "City"
For Each oDLE In .DropdownListEntries
If oDLE.Text = .Range.Text Then
.Range.Text = oDLE.Value
Exit For
End If
Next oDLE
Case "Phone"
For Each oDLE In .DropdownListEntries
If oDLE.Text = .Range.Text Then
.Range.Text = oDLE.Value
Exit For
End If
Next oDLE
Case "Fax"
For Each oDLE In .DropdownListEntries
If oDLE.Text = .Range.Text Then
.Range.Text = oDLE.Value
Exit For
End If
Next oDLE
Case "License"
For Each oDLE In .DropdownListEntries
If oDLE.Text = .Range.Text Then
.Range.Text = oDLE.Value
Exit For
End If
Next oDLE
Case "Contractor"
For Each oDLE In .DropdownListEntries
If oDLE.Text = .Range.Text Then
.Range.Text = oDLE.Value
ActiveDocument.SelectContentControlsByTitle("Company").Item(1).Range.Text = oDLE.Value
Exit For
End If
Next oDLE
End Select
End With
End Sub
All other dropdown boxes have the same Display Name and Value. Suggestions?