hello all,
I hope someone is there to help me out this. I am spliting a text file.
and after splitting I want to concate the string 1 and string2 and string three and thereafter the normal string 4 ,5,6,7,8,9,10 etc.
But when I debug the total string I got this problem that subscript out of range. I am not getting where I am doing wrong.
My code in vb6 are as :
Private Sub getdata()
Dim onestr As String
Dim twostr() As String
Dim threestr() As String
Dim onenum As Long
Dim one, two As Integer
Dim onedata As String
Dim anilstr As String
anilstr = App.Path & "\anil.txt "
Debug.Print anilstr
Dim fso As FileSystemObject
Dim ts As TextStream
Dim dl As String

Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(anilstr, ForReading, True)

dl = ts.ReadAll
onestr = Replace(dl, Chr$(10), vbCrLf)
twostr() = Split(onestr, vbCrLf, , 1)
onenum = UBound(twostr, 1) - 1
For one = 0 To onenum
threestr() = Split(twostr(one), ",", -1, 1)

Debug.Print threestr(2) & "-" & threestr(3) & "-" & threestr(4) & "," & threestr(0) & "-" & threestr(1) & "," & threestr(5) & "," & threestr(6) & "," & threestr(7) & vbCrLf


Next one

one = one + 1

End Sub
....................................
can anyone help me out there ????

hello all,
I hope someone is there to help me out this. I am spliting a text file.
and after splitting I want to concate the string 1 and string2 and string three and thereafter the normal string 4 ,5,6,7,8,9,10 etc.
But when I debug the total string I got this problem that subscript out of range. I am not getting where I am doing wrong.
My code in vb6 are as :
Private Sub getdata()
Dim onestr As String
Dim twostr() As String
Dim threestr() As String
Dim onenum As Long
Dim one, two As Integer
Dim onedata As String
Dim anilstr As String
anilstr = App.Path & "\anil.txt "
Debug.Print anilstr
Dim fso As FileSystemObject
Dim ts As TextStream
Dim dl As String

Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(anilstr, ForReading, True)

dl = ts.ReadAll
onestr = Replace(dl, Chr$(10), vbCrLf)
twostr() = Split(onestr, vbCrLf, , 1)
onenum = UBound(twostr, 1) - 1
For one = 0 To onenum
threestr() = Split(twostr(one), ",", -1, 1)

Debug.Print threestr(2) & "-" & threestr(3) & "-" & threestr(4) & "," & threestr(0) & "-" & threestr(1) & "," & threestr(5) & "," & threestr(6) & "," & threestr(7) & vbCrLf


Next one

one = one + 1

End Sub
....................................
can anyone help me out there ????

Hello all,
thanks to all. I got my solution.
Thanks

This question has already been answered. Start a new discussion instead.