View Single Post
 
Old 04-23-2025, 10:19 AM
CompletelyLost CompletelyLost is offline Windows 11 Office 2021
Novice
 
Join Date: Apr 2025
Posts: 4
CompletelyLost is on a distinguished road
Default

Thanks Greg. Here's my problem. I already have a macro with Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean), so when I try to start another one, it tells me it's already in use. I've tried merging them together and that didn't work. It just messed up the first one. Did I mention I'm not a programmer and have no idea what I'm doing LOL. This is said current macro using the ContentControlOnExit:

Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Dim oDLE As ContentControlListEntry
With CCtrl
If .Type = wdContentControlComboBox Then
For Each oDLE In .DropdownListEntries
If oDLE.Text = .Range.Text Then
.Range.Text = oDLE.Value
Exit For
End If
Next
End If
End With
End Sub

That said, I was trying to avoid having to spell out exactly the contractor name that is selected in the drop down as there is no difference in Display Name and Value as you show by using the Case function. The above macro is being used to select the Value instead of the Display name in dropdowns that are different. I just want if Company A is selected from the Contractor dropdown, I want my Company text box to show Company A. Can I add what I want to the above macro somehow? If this is not possible, I will have to type out all of the companies as you have suggested by using the Case function, but how do I merge it with the above so I don't get an error?

This will be an internal document only. It's basically a contract that I'm trying to make idiot proof LOL.
Reply With Quote