InRange Method Example

This example determines whether the selection is contained in the first paragraph in the active document.

status = Selection.InRange(ActiveDocument.Paragraphs(1).Range)

This example sets myRange equal to the first word in the active document. If myRange isn't contained in the selection, myRange is selected.

Set myRange = ActiveDocument.Words(1)
If myRange.InRange(Selection.Range) = False Then myRange.Select

This example displays a message if the selection is in the footnote story.

If Selection.InRange(ActiveDocument _
        .StoryRanges(wdFootnotesStory)) Then
    MsgBox "Selection in footnotes"
End If