View Single Post
 
Old 03-30-2019, 10:37 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

I think the answer to your question is "no" you can't query both .Tag and .Title simultaneously to find the content control of interest.


For what is seems to me you are trying to do though, something like this might do.



Code:
Private Sub Document_ContentControlOnExit(ByVal oCC As ContentControl, Cancel As Boolean)
Dim collCCs As ContentControls
Dim oCCTarget As ContentControl
  Select Case oCC.Tag
    Case "a"
      Set collCCs = ActiveDocument.SelectContentControlsByTag("b")
      For Each oCCTarget In collCCs
        If oCCTarget.Title = oCC.Title Then
          oCCTarget.Range.Select
          Exit For
        End If
      Next
  End Select
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote