View Single Post
 
Old 05-21-2020, 10:25 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Jay,


I don't know how much clearer the code in that tutorial document can be. You have to convert the CC from a DDL to a RT or PT control.



Something like this. See attached file.


Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
  Select Case ContentControl.Title
    Case "DDL"
      ContentControl.Type = 0
      Select Case ContentControl.Range.Text
        Case "SAS": InsertBB_atRTCC_Range "DDL", "SAS"
        Case "A": InsertBB_atRTCC_Range "DDL", "Text1"
        Case "B": InsertBB_atRTCC_Range "DDL", "Text2"
        Case "C": InsertBB_atRTCC_Range "DDL", "Text3"
        Case "D": InsertBB_atRTCC_Range "DDL", "Text4"
        Case Else: InsertBB_atRTCC_Range "DDL"
      End Select
      ContentControl.Type = 4
  End Select
lbl_Exit:
  Exit Sub
End Sub

Sub InsertBB_atRTCC_Range(CCTitle As String, Optional BBName As String = vbNullString)
Dim oTmp As Template
Dim oRng As Range
  Set oTmp = ThisDocument.AttachedTemplate
  Set oRng = ActiveDocument.SelectContentControlsByTitle(CCTitle).Item(1).Range
  If Not BBName = vbNullString Then
    oTmp.BuildingBlockEntries(BBName).Insert oRng, True
  Else
    oRng.Text = vbNullString
  End If
lbl_Exit:
  Exit Sub
End Sub
Attached Files
File Type: dotm CC DDL convert to RichText with BuildingBlock.dotm (30.7 KB, 28 views)
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote