View Single Post
 
Old 04-01-2020, 01:18 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You could use a simple function to fill a rich text content control with the formatted text from the autotext entry, according to the value selected in the list box (see attached template) e.g. as follows - Create a new document from the template


Code:
Sub AutoTextToCC(strCCName As String, oTemplate As Template, strAutotext As String)
'Graham Mayor - https://www.gmayor.com - Last updated - 10 Apr 2019
'strCCName is the ContentControl title
'oTemplate is the template with the autotext entry
'strAutotext is the name of the autotext entry
Dim oCC As ContentControl
    On Error GoTo lbl_Exit
    For Each oCC In ActiveDocument.ContentControls
        If oCC.TITLE = strCCName Then
            oCC.LockContentControl = True
            oTemplate.AutoTextEntries(strAutotext).Insert Where:=oCC.Range, RichText:=True
            Exit For
        End If
    Next oCC
lbl_Exit:
    Exit Sub
End Sub

You may find Insert Content Control Add-In useful for entering and/or modifying the content controls.
Attached Files
File Type: dotm Content Controls - Dropdown Dependent Text.dotm (40.3 KB, 25 views)
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote