View Single Post
 
Old 01-16-2024, 06:44 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,159
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I also support Italophile's advice, you should be storing the insertable formatted content into building blocks which can be retrieved anytime the macro requires it. Demo code to put it into a Rich Text Content Control looks like this.
Code:
Private Sub Document_ContentControlOnexit(ByVal aCC As ContentControl, Cancel As Boolean)
  Dim aCC2 As ContentControl, sTag As String, aTemplate As Template
  
  If aCC.Type = wdContentControlCheckBox Then
    sTag = aCC.Tag
    Set aTemplate = ActiveDocument.AttachedTemplate
    Set aCC2 = ActiveDocument.SelectContentControlsByTitle(sTag)(1)
    With aCC2
      If aCC.Checked Then
        aTemplate.BuildingBlockEntries("aa").Insert where:=aCC2.Range, RichText:=True
      Else
        aCC2.SetPlaceholderText Text:="Blank"
        aCC2.Range.Text = ""
      End If
    End With
  End If
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote