This is another slave/utility function for the bookmark suite. This baby obtains a set of ranges for the text which is not yet bookmarked.

Some of my training-course material text is already bookmarked with "sensible" bookmark names.

This slave function helps me bookmark all the remaining text.

End result will be that all tetx sits in at least one bookmark range, and the Customizer can do its job.

<pre>Public Function BkMkRanges(lngAr() As String, lngToDo() As String)
' Procedure : BkMkRanges
' Description: Identify all text that is *not* bookmarked.
' By: Chris Greaves Inc.
' Inputs: Array of ranges.
' Returns: None.
' Assumes: Nothing
' Side Effects: None.
' Tested: By the calls shown below.

' (1) Identify ranges for all bookmarked text
' (2) Identify total range
' (3) Mark those ranges of (2) not in (1)
' (1) Identify ranges for all bookmarked text
ReDim lngAr(2, 0) ' Array to hold ranges of all bookmarked text
ReDim lngToDo(2, 0) ' Array to hold those ranges that are not bookmarked
' Identify ranges of all bookmarked text
Dim bkmk As Bookmark
For Each bkmk In ActiveDocument.Bookmarks
lngAr(0, UBound(lngAr, 2)) = bkmk.Range.Start
lngAr(1, UBound(lngAr, 2)) = bkmk.Range.End - 1
lngAr(2, UBound(lngAr, 2)) = bkmk.Name
ReDim Preserve lngAr(2, UBound(lngAr, 2) + 1)
Next bkmk
If UBound(lngAr, 2) > 0 Then
ReDim Preserve lngAr(2, UBound(lngAr, 2) - 1) ' Drop the trailing empty item
Call SortArray(lngAr, 0, 0, 0) ' Sort ascending key on first column (range.start)
' (2) Identify total range
Dim lngStoryStart As Long
Dim lngStoryEnd As Long
lngStoryStart = ActiveDocument.Range.Start
lngStoryEnd = ActiveDocument.Range.End
' (3) mark those ranges of (2) not in (1)
Call GetTodo(lngAr, lngStoryStart, lngStoryEnd, lngToDo)
End If
'Sub TESTBkMkRanges()
'' Thje code below builds an array of all bookmark positions, _
and an array of unmarked text range positions.
' Dim lngAr() As String
' Dim lngToDo() As String
' Call BkMkRanges(lngAr(), lngToDo())
'End Sub
End Function