This is string.split method coding from VB Net. It won't work in VBA (never did for me, at any rate). You need to split TLine into a variable defined as Variant and then seek the upper limit of the array as the number of line feeds that occur, eg.::
Code:
Dim MAX as Integer, txt as Variant, TLine as String
TLine = "This is" & vbLf & "a sample of" & vbLf & "a hen crossing " & vbLf & "the street"
txt = Split(TLine, Chr(10))
MAX = UBound(txt)
This is string.split method coding from VB Net. It won't work in VBA (never did for me, at any rate). You need to split TLine into a variable defined as Variant and then seek the upper limit of the array as the number of line feeds that occur, eg.::
Code:
Dim MAX as Integer, txt as Variant, TLine as String
TLine = "This is" & vbLf & "a sample of" & vbLf & "a hen crossing " & vbLf & "the street"
txt = Split(TLine, Chr(10))
MAX = UBound(txt)
Thanks a lot for the help. Sorry I could not get back sooner. I have solved the problem in a similar way by storing the result of the split function in an array.
Thanks a lot for the help. Sorry I could not get back sooner. I have solved the problem in a similar way by storing the result of the split function in an array.