View Single Post
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
alborg alborg is offline
external usenet poster
 
Posts: 67
Default FORMATION COLUMNS

Gosh, I don't know why you would want to do this, but I agree with Kathy that
Excel would be an easier environment to do this feat. You can do it inside MS
Word by parsing the text with a Do While... Loop and adding in the commas
every 7 characters. I would do is something like this:

Sub test()
Dim ii As Long, xx As String, yy As String, myRange As Range
Set aDoc = ActiveDocument
Set myRange = aDoc.Range(Start:=aDoc.Paragraphs(1).Range.Start,
End:=aDoc.Paragraphs(1).Range.End)
myRange.ConvertToTable Separator:=wdSeparateByParagraphs
ii = Len(myRange)
xx = myRange
myRange.Delete
Do While ii 0
If ii 7 Then
yy = yy & xx
ii = 0
Else
yy = yy & Left(xx, 7) & ", "
ii = ii - 7
xx = Right(xx, ii)
End If
Loop

With Selection
.Collapse
.InsertBefore yy
End With
Set myTable = _
Selection.ConvertToTable(Separator:=wdSeparateByCo mmas, _
Format:=wdTableFormatList1)
End Sub

Good luck... With the above I ended up taking a 229 character paragraph and
separating it into skinny little columns, each with 7 lined up characters.
Kind of ugly, but it seems to be what you want. 8^)

Cheers,
Al

"JTEFUN" wrote:

I need to take a srting of data and break it apart by columns and only 7
characters per column. Is this something that is posible?
--
JTEFUN