Thread: [Solved] Bookmark content controls
View Single Post
 
Old 06-12-2016, 04:30 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,363
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

Assuming the content controls to be bookmarked are all in table cells, you could use:

Code:
Sub Demo()
Application.ScreenUpdating = False
Dim CCtrl As ContentControl, Rng As Range
For Each CCtrl In ActiveDocument.ContentControls
  With CCtrl
    If .Range.Information(wdWithInTable) = True Then
      Set Rng = .Range.Cells(1).Range
      With Rng
        .End = .End - 1
        .Bookmarks.Add CCtrl.Title, Rng
      End With
    End If
  End With
Next
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote