View Single Post
 
Old 01-05-2021, 09:38 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,105
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

The best way to do this would be to create a template that you can supply to colleagues.
The template would contain a userform in which you select the various options required for the document Create a userform .
It is then a relatively simple matter to write the variable text items to the document using rich text content controls to hold the formatted data which could be held in autotext entries stored in the template, using code similar to
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
If you need a specialist, contact me via my web site.
__________________
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