Oops!

Cut'n'paste typo in the bit of code handling the remaining string.

Code should be:
Code:
Function ChopString($s,Optional $l, Optional $d)
Dim $i

; Handle optional parameters
$l=CInt($l)
If Not $l $l=80 EndIf
If $d="" $d="," EndIf

; Deal with null strings
If $s="" Redim Preserve $ChopString[0] Exit 0 EndIf

; Break out long string lengths
While Len($s)>$l
$i=InStrRev(Left($s,$l),$d)
If $i<0 $i=InStr($s,$d) EndIf
Redim Preserve $ChopString[UBound($ChopString)+1]
$ChopString[UBound($ChopString)]=Left($s,$i)
$s=SubStr($s,$i+1)
Loop

; Grab what's left of the string
If $s<>""
Redim Preserve $ChopString[UBound($ChopString)+1]
$ChopString[UBound($ChopString)]=$s
EndIf

Exit 0
EndFunction