Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-29-2019, 04:27 PM
macropod's Avatar
macropod macropod is offline Finding specific Content Control based on both title and tag Windows 7 64bit Finding specific Content Control based on both title and tag Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

It's not exactly clear what determines the decision to process by tag or title. Perhaps something along the lines of:
Code:
Private Sub Document_ContentControlOnExit(ByVal oCC As ContentControl, Cancel As Boolean)
Dim i As Long
With ActiveDocument
  Select Case oCC.Tag
    Case "a"
      For i = 1 To .SelectContentControlsByTag(oCC.Title).Count
        .SelectContentControlsByTag(oCC.Title)(i).Range.Text = ""
      Next
  End Select
End With
End Sub
or:
Code:
Private Sub Document_ContentControlOnExit(ByVal oCC As ContentControl, Cancel As Boolean)
Dim i As Long
With ActiveDocument
  For i = 1 To .SelectContentControlsByTag(oCC.Tag).Count
    .SelectContentControlsByTag(oCC.Tag)(i).Range.Text = ""
  Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
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 10:15 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