![]() |
#8
|
|||
|
|||
![]()
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 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
angelaschultz | Word VBA | 7 | 03-18-2017 03:00 PM |
![]() |
GregStewartPTC | Word VBA | 2 | 02-27-2017 05:37 AM |
![]() |
vera | Word VBA | 1 | 10-07-2016 07:41 PM |
VBA Word - Building Block (AutoText) - Array - Replace Text with Specific Building Blocks | jc491 | Word VBA | 7 | 01-03-2016 10:34 PM |
Building blocks show correctly in dropdown, but wrong building block populates in doc | wordgirl123 | Word | 0 | 10-03-2013 08:30 AM |