|
|
|
date: Fri, 4 Apr 2008 10:44:07 +0100,
group: microsoft.public.word.vba.beginners
back
Re: Insert Line Break every 215 Characters
"Gregory K. Maxey" wrote:
> Helmut,
>
> Interesting. I would have done it like this:
> Sub Scratchmacro()
> Dim oRng As Word.Range
> Set oRng = ActiveDocument.Range
> Do While oRng.End - oRng.Start > 215
> oRng.MoveStart wdCharacter, 215
> oRng.InsertBefore Chr(11)
> Loop
> End Sub
Hi Greg,
I like the range solution, but, you have to tweak it a bit. When you add
Chr(11), it becomes part of the range, so at the next pass, you would have to
move the start by 216, not 215.
Try something like this instead:
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
With oRng
Do While .End - .Start > 215
.MoveStart wdCharacter, 215
.InsertBefore Chr(11)
.MoveStart wdCharacter, 1
Loop
End With
date: Fri, 4 Apr 2008 05:26:07 -0700
author: Jean-Guy Marcil
|
|