Would it be possible to create the bookmark for DocumentToCheck dynamically within the code based on the preceding and following headings? I need to be able to run this without the document including special elements, instead just having the document's normal formatting and structure.
Could the word LIST in uppercase be found, the list ABSTRACT in uppercase be found, a range defined from immediately following the last character of LIST to immediately preceding the first character of ABSTRACT, and then add the bookmark to that range? (Not that I know how to write the code to define the range that I just suggested...)
Edit: I think this code should achieve what I describe above (searching up from the bottom of the document), but VBE is not cooperating at the moment.
Code:
Dim startPosition As Long, endPosition As Long, listRange As Range
Selection.EndKey Unit:=wdStory
With Selection.Find
.ClearFormatting
.Forward = Flase
.Format = True
.MatchWholeWord = True
.MatchCase = True
.MatchWildcards = False
.Execute FindText:=uCase("ABSTRACT")
endPosition = Selection.Range.Start
With Selection.Find
.ClearFormatting
.Forward = False
.Format = True
.MatchWholeWord = True
.MatchCase = True
.MatchWildcards = False
.Execute FindText:=uCase("LIST")
startPosition = Selection.Range.End
listRange.SetRange Start:=startPosition, End:=endposition
ActiveDocument.Bookmarks.Add Name:="ListArea", Range:=listRange