Hi,
as this is a programmers group,
i'm assuming, you can adjust the
following to your needs.
It is just to you give you an idea
of what could be done.
But keep in mind Tony's remark.
Sub Test100a()
Dim rDcm As Range
Dim rTmp As Range
Dim lTmp As Long
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "over "
.MatchWholeWord = True
While .Execute
rDcm.Select
If rDcm.Bookmarks("\line").Range.Words.Last = "over " Then
Set rTmp = rDcm.Bookmarks("\line").Range.Words.Last
rTmp.Select ' for testing
lTmp = MsgBox("move?", vbYesNo)
If lTmp = vbYes Then
rTmp.InsertBefore Chr(11)
End If
End If
Wend
End With
End Sub
Sub Test100b()
Dim rDcm As Range
Dim rTmp As Range
Dim lTmp As Long
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "over "
.MatchWholeWord = True
While .Execute
rDcm.Select
If rDcm.Bookmarks("\line").Range.Words.Last = "over " Then
Set rTmp = rDcm.Bookmarks("\line").Range.Words.Last
rTmp.Select ' for testing
lTmp = MsgBox("move?", vbYesNo)
If lTmp = vbYes Then
rTmp.Characters.Last = Chr(160)
End If
End If
Wend
End With
End Sub
--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Vista Small Business, Office XP
The point is that lines (and pages) are transient objects in Word and it is
often counter-productive trying to impose your own structure. The way to do
this is to add a non-breaking space after the word(s) - instead of a normal
space. Replace "on " - without the quotes, that's o,n, space - with "on^s" -
again without the quotes, o, n, caret, s. Word will then treat "on", the
non-breaking space, and the following character(s) as one word and not end
the line with on.

Signature
Enjoy,
Tony
>I agree, normally I would let Word flow the text, but in some languages it
>is
[quoted text clipped - 38 lines]
>> > of
>> > a line.
Helmut Weber - 06 Jan 2008 14:54 GMT
Hi Tony,
sure, that's the way.
I was thinking about answering the original question
instead of thinking about the problem.
:-)
--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Vista Small Business, Office XP
jlhamann - 06 Jan 2008 20:03 GMT
Thanks Tony, that was the information I needed.
> The point is that lines (and pages) are transient objects in Word and it is
> often counter-productive trying to impose your own structure. The way to do
[quoted text clipped - 46 lines]
> >> > of
> >> > a line.