Insert carriage return after every character

So my logic is to have a button the when pressed will loop through each character and place a carriage return. Ive added the returns but they only happen at the end of the word not after each character. What am i missing?

Dim txt As String, s As Shape, i as integer
If s.Type = cdrTextShape Then
txt = ActiveShape.Text.Story.Text
' go through each character in the text (txt)
For i = 1 To Len(txt)
ActiveShape.Text.Story.InsertAfter (Chr(13))
Next i
End If
  • I saw your question has already been answered in the other forum. Since this is the developer forum I thought I would show you a little more advanced way to to this. Starting with CorelDRAW X5 you can use Regular Expressions. So you could do something like this:

    ActiveShape.Text.Story = ActiveShape.Text.Story.Evaluate("@text.RegReplace('(.)','$1 ')")
    

    It is difficult to see but there is a space after the $1 so don't miss that.

    Here is a list of new string functions they added for X5:

    string.RegMatch(string, [bool])
    string.ParseInt([int])
    string.RegMatchEx(string, [bool])
    string.RegContains(string, [bool])
    string.RegContainsEx(string, [bool])
    string.RegReplace(string, string, [bool])
    string.RegReplaceEx(string, expression, [bool])
    string.RegSplit(string, [bool])
    string.RegFind(string, [bool])



    Hope that helps and gives you another idea of how to make it work. :-)

    -Shelby