Hi! Maybe someone will spot why I loose my extend selection when I try
to block after the second search? Appreciate your help.

' Removes existing contractor data
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Contractors"
.Style = "Heading 2"
.Forward = True
.Execute
If Not .Found Then GoTo SaveClose
End With


With Selection
.MoveRight Unit:=wdCharacter, Count:=2
.ExtendMode = False
.ExtendMode = True
End With '*******works fine here


Selection.Find.ClearFormatting
'Leave notes alone
With Selection.Find
.Text = "NOTE(S):"
.MatchCase = True
.Forward = True
.Execute '***works fine here
End With

If Selection.Find.Found Then GoTo SkipHead2
'check for nect section if note: not found

With Selection
.ExtendMode = False '***does not shut off here
.ExtendMode = True ' does not work
End With

With Selection.Find
.Text = "T"
.Style = "Heading 2"
.Forward = True
.Execute
End With 'loose the extend here
SkipHead2:
With Selection
.HomeKey Unit:=wdLine
.ExtendMode = True
End With
Selection.Delete Unit:=wdCharacter, Count:=1 'deletes the T xwrong

Re: selection extend problem by Helmut

Helmut
Wed Feb 02 17:11:28 CST 2005

Hi,
very difficult to read from your code what you really want.
Especially
>.ExtendMode = False
>.ExtendMode = True
makes no sense to me.
Usually, these commands are very reliably.
Anyway,

>Selection.Find.ClearFormatting
>With Selection.Find
>.Text = "NOTE(S):"
>.MatchCase = True
>.Forward = True
>.Execute '***works fine here
>End With
>
>If Selection.Find.Found Then GoTo SkipHead2 '!!!

causes a a new find process in the current selection,
I think, and from then on it's all a mess.
If you want to know, whether a find operation
has been successfull, use
if .execute then
or
while .execute
respectively

Greetings from Bavaria, Germany

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/