Hi FotoArt,
if you search for a string
and the string is found,
and you do nothing to what is then the selection,
then the selection stays the found range,
and your search finds the string again.
Thats the way I'do it:
Sub LetsDivideA()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "***"
While .Execute
rDcm.InsertBreak Type:=wdSectionBreakNextPage
rDcm.Start = rDcm.End + 1 '!
rDcm.End = ActiveDocument.Range.End '!
Wend
End With
End Sub
Pay special attention to the part of the code,
which redefines rDcm.

Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
FotoArt - 25 Sep 2007 19:06 GMT
hello weber
How could I insert the section break after the asterics.
What happens now is the break comes before the "***"
thanx
ahmed
> Hi FotoArt,
>
[quoted text clipped - 21 lines]
> Pay special attention to the part of the code,
> which redefines rDcm.
Helmut Weber - 25 Sep 2007 19:29 GMT
Hi Ahmed,
like that:
Sub LetsDivideAA()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "***" & Chr(12)
While .Execute
rDcm.Select ' for testing using single step mode
rDcm.Characters.Last = ""
rDcm.Collapse direction:=wdCollapseEnd
rDcm.Select ' for testing using single step mode
rDcm.InsertBreak Type:=wdSectionBreakNextPage
rDcm.Collapse direction:=wdCollapseEnd
rDcm.Select ' for testing using single step mode
Wend
End With
End Sub
Which works, beware, on every chr(12) preceded by 3 asteriscs,
no matter, what kind of break it is.
For learning about the whole truth about chr(12), see:
KindOfBreak12
http://tinyurl.com/ynwgnv

Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"