-
The string doesn't trim, i have to remove the leading spaces on all the lines except the first one which doesn't have one.
Code:
Dim t() As String
Dim x As Integer
t = Split(ls, vbCrLf)
For x = 0 To UBound(t)
Trim (t(x))
posi(1) = 1 'position cursor is on 2nd letter
For k = 1 To 17 ' make spaces array
l = InStr(posi(k), t(x), " ", vbTextCompare)
I know that the split command doesn't return strings but array but how can i remove those leading spaces ?
-
Have you tried the Left or Mid functions to basically trim the spaces?
-
If you are talking about LTrim, yes i've tried that. It won't work.
I even tried Trim(Cstr(t(x)))
No luck.
-
What is ls? Can I see the all/some more of the code you have?
-
Trim is a Function, not a Sub.
Try
t(x) = Trim(t(x))
-
Thanx John , you were right.
And ls is just a reference to a string.