View Single Post
 
Old 04-22-2025, 09:59 PM
CompletelyLost CompletelyLost is offline Windows 11 Office 2021
Novice
 
Join Date: Apr 2025
Posts: 4
CompletelyLost is on a distinguished road
Default How to auto populate a rich text content control box from a selection in a combo control box

I have Office 365 and that wasn't an option to choose. I am creating a template in Word. I have tried everything I can think of, but I'm not a programmer. All I want to do is have a text box titled "Company" automatically populate based on a dropdown combo content box titled "Contractor", selected value. I think I've tried every option in other threads that I could find. This is the last one and it's not working. I don't know if it makes a difference or not, but the "Company" text box is in the header and the "Contractor" dropdown box is in the main document.

Private Sub Document_ShowTextBasedOnDropdown(ByVal CCtrl As ContentControl, Cancel As Boolean)
Dim i As Long, StrDetails As String
With CCtrl
If .Title = "Company" Then
For i = 1 To .DropdownListEntries.Count
If .DropdownListEntries(i).Text = .Range.Text Then
StrDetails = ActiveDocument.SelectContentControlsByTitle("Contr actor").Item(1).Range.Text
Exit For
End If
End With
End If
End Sub

If I can get this to work, I also have another text box that needs to auto populated based on another text box. So like "Project Name 1" populates "Project Name 2".
Reply With Quote