Maybe this will explain
Sub test()
Dim i As Long, s As string
s = "A" & vbCr & "B" & vbLf & "C" & vbNewLine & "D"
For i = 1 To Len(s)
Debug.Print i, Asc(Mid(s, i, 1))
Next
s = Replace(s, vbCr, vbLf)
s = Replace(s, vbLf & vbLf, vbLf)
Debug.Print
For i = 1 To Len(s)
Debug.Print i, Asc(Mid(s, i, 1))
Next
s = Replace(s, vbCr, vbLf)
arr = Split(s, Chr(10))
For i = 0 To UBound(arr)
Debug.Print arr(i)
Next
End Sub
Ctrl-g to view the Immediate window
Of course don't use as written if your string might have double line breaks.
Regards,
Peter T
> I am using John Walkenbach function to extract the Nth element from a string:
> this is working fine in most cases bit not when one of my Separator is
[quoted text clipped - 10 lines]
> EXTRACTELEMENT = AllElements(n - 1)
> End Function