Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 03-30-2019, 02:05 AM
gmayor's Avatar
gmayor gmayor is offline Finding specific Content Control based on both title and tag Windows 10 Finding specific Content Control based on both title and tag Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,142
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 ofgmayor has much to be proud of
Default

I would be inclined to do somethiung like the following where you could setup the conditions for all the controls you want to process in this way. Here I have just processed those with the title '1".


Code:
Private Sub Document_ContentControlOnExitold(ByVal oCC As ContentControl, Cancel As Boolean)
Dim jCC As ContentControl

    With oCC
        If .Title = "1" Then
            Select Case .Tag
                Case Is = "a"
                    For Each jCC In ActiveDocument.ContentControls
                        If jCC.Title = "1" And jCC.Tag = "b" Then
                            jCC.Range.Select
                            Exit For
                        End If
                    Next jCC
                Case Is = "b"
                    For Each jCC In ActiveDocument.ContentControls
                        If jCC.Title = "1" And jCC.Tag = "c" Then
                            jCC.Range.Select
                            Exit For
                        End If
                    Next jCC
                Case Is = "c"
                    For Each jCC In ActiveDocument.ContentControls
                        If jCC.Title = "2" And jCC.Tag = "a" Then
                            jCC.Range.Select
                            Exit For
                        End If
                    Next jCC
            End Select
        End If
    End With
End Sub
__________________
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding specific Content Control based on both title and tag Automating entries based on the entry in a Content Control gsbpxw Word VBA 1 10-22-2018 12:45 PM
VBA to provide text string with specific formating based on Drop down list (content control) MP1989 Word VBA 4 07-30-2018 02:40 AM
How to display tag in Content Control instead of title vinbalraj Word 1 03-02-2018 08:55 AM
Finding specific Content Control based on both title and tag Finding field names in a Word-Form created by content control shammi_raj Word 1 03-10-2016 02:37 AM
Finding specific Content Control based on both title and tag Code to Sum Column of Content Control Values In Specific Tables? warbird Word VBA 2 07-13-2015 05:44 AM

Other Forums: Access Forums

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


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