#include <Word.au3>
#include <Array.au3>
$oWord = _Word_Create()
$oDoc=_Word_DocOpen($oWord,@ScriptDir&'\test.docx')
$Pos1=ContextSearch("текст1")
$Pos2=ContextSearch("текст2")
$oDoc.Range($Pos1[1],$Pos2[0]).Select
$Data=$oDoc.Range($Pos1[1],$Pos2[0]).Text
MsgBox(0,'Найденный фрагмент',$Data)
$Pos1=ContextSearch("текст3")
$Pos2=ContextSearch("текст4")
$oDoc.Range($Pos1[1],$Pos2[0]).Select
Func ContextSearch($Context,$Occurrence=1)
Local $KolOccurrence=0
Local $aPos[2]=[0,0]
$oWord.Documents(1).Select
For $i=1 To $Occurrence
$oWord.Selection.Find.Text = $Context
$oWord.Selection.Find.ClearFormatting
$oWord.Selection.Find.Execute
If $oWord.Selection.Find.Found()=False Then
MsgBox(16,'Не найден '&$i&' фрагмент',$Context)
Exit
EndIf
$KolOccurrence+=1
If $Occurrence=$KolOccurrence Then
$aPos[0]=$oWord.Selection.start
$aPos[1]=$oWord.Selection.End
Return $aPos
EndIf
Next
EndFunc