Thread: [Solved] Save Selection
View Single Post
 
Old 01-15-2011, 07:10 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,374
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

Hi Brock,

Sorry - I hadn't tested the code properly before posting. Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim strTmp As String, oCel As Cell, rngTmp As Range, i As Integer, j As Integer
With ActiveDocument
  If .Sections.Count > 3 Then
    For i = 4 To .Sections.Count
      With .Sections(i).Range
        If .ContentControls.Count > 0 Then
          strTmp = .ContentControls(1).Range.Text
          For j = 2 To .ContentControls.Count
            strTmp = strTmp & ":" & .ContentControls(j).Range.Text
            If j > 2 Then Exit For
          Next j
          For Each oCel In .Tables(1).Range.Cells
            Set rngTmp = oCel.Range
            rngTmp.End = rngTmp.End - 1
            If rngTmp.Text = vbNullString Then
              ActiveDocument.Indexes.MarkEntry Range:=rngTmp, Entry:=strTmp, _
                CrossReference:="", CrossReferenceAutoText:="", _
                BookmarkName:="", Bold:=False, Italic:=False
              Exit For
            End If
          Next oCel
        End If
      End With
    Next i
  End If
End With
Set rngTmp = Nothing
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote