How to split text of all document for separate string with 15characters in every string?

A

avkokin

Hello.
There is a document with text. If every strings of this text has more
15 characters, then I need to split every string on separate strings
with 15 characters into every string.
E.G. there is text: 111111111111111111111111111...111
I need to get it so:
111111111111111
111111111111111
....
111111111111111
I know that there is the function Split, but I can't understand how to
use it for my case. Give me any tips, please.
Thank you very much.
 
A

avkokin

I found one way (on this group), thank's Jay Freedman.
That is acceptable code:
Sub razmer_stroki_15()
Const chunkSize = 15
Dim oRg As Range
Dim actualSize As Long
Set oRg = ActiveDocument.Range
With oRg
.Collapse wdCollapseStart
actualSize = .MoveEnd(Unit:=wdCharacter, Count:=chunkSize)
Do While actualSize = chunkSize
.InsertAfter vbCr
.Collapse wdCollapseEnd
actualSize = .MoveEnd(Unit:=wdCharacter, Count:=chunkSize)
Loop
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top