Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 05-21-2020, 10:25 AM
gmaxey gmaxey is offline Auto populate building block autotext on dependent drop down exit Windows 10 Auto populate building block autotext on dependent drop down exit Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,598
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
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, 34 views)
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto populate building block autotext on dependent drop down exit auto populate multiple text boxes dependent on a drop down angelaschultz Word VBA 7 03-18-2017 03:00 PM
Auto populate building block autotext on dependent drop down exit Auto Populate Text On Dependent Drop Down Exit GregStewartPTC Word VBA 2 02-27-2017 05:37 AM
Auto populate building block autotext on dependent drop down exit How to populate dependent dropdowns and auto-fill text fields simultaneously? 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

Other Forums: Access Forums

All times are GMT -7. The time now is 06:06 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft