Hi,
this simplified example
searches for "source",
searches for "screen "x,
switches on extendmode,
searches for "screen "x+1,
shortens the selection by 8 characters
copies the selection to the clipboard.
I am assuming, that "resetsearch" is still available,
that all searched for expressions are in the text
and in the appropriate order, that the selection is
the insertion point and somewhere in the text before "source"!
Lots of assumptions, but otherwise it would not be an example anymore.
---
Sub Test448()
Dim sFnd1 As String ' string to find screen x
Dim sFnd2 As String ' string to find screen x + 1
sFnd1 = 5 'InputBox("search for screen #")
sFnd2 = sFnd1 + 1
sFnd1 = "screen " & sFnd1
sFnd2 = "screen " & sFnd2
ResetSearch
Selection.Collapse
Selection.ExtendMode = False
With Selection.Find
.Text = "source"
.Wrap = wdFindStop
.Execute
Selection.Collapse direction:=wdCollapseEnd
.Text = sFnd1
Selection.Collapse direction:=wdCollapseEnd
Selection.ExtendMode = True
.Text = sFnd2
.Execute
Selection.End = Selection.End - 8
Selection.Copy
End With
ResetSearch
End Sub
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/