Here is all my code for this section
Dim reportArray() As String
Dim reportstring(0, 4) As String
Dim Report As String
Dim cnt As Integer
Dim i As Integer
Dim x As Integer
cnt = 0
Open "file.txt" For Input As #4
x = 0
Do Until (EOF(4))
Line Input #4, iCopyString
reportArray = Split(iCopyString, ",", -1)
For i = 0 To 4
****below is error array already dimensioned****
reportstring(x, i) = reportArray(i)
Next
cnt = cnt + 1
ReDim reportstring(x + 1, 4)
x = x + 1
DoEvents
Loop
Close #4
**** This is just to show me its working *****
Load frmError
iCopyString = ""
For i = 0 To cnt
For x = 0 To 4
iCopyString = iCopyString & reportstring(i, x) & " "
Next
iCopyString = iCopyString & vbCrLf
Next
frmError.Text1.Text = iCopyString
I am trying to move a csv file into a two dimensional array so that I can take the parts of the array I need along with other info and write it to a new file. Problem is I do not know the number of lines in the csv file (it changes daily)
can any help
Dim reportArray() As String
Dim reportstring(0, 4) As String
Dim Report As String
Dim cnt As Integer
Dim i As Integer
Dim x As Integer
cnt = 0
Open "file.txt" For Input As #4
x = 0
Do Until (EOF(4))
Line Input #4, iCopyString
reportArray = Split(iCopyString, ",", -1)
For i = 0 To 4
****below is error array already dimensioned****
reportstring(x, i) = reportArray(i)
Next
cnt = cnt + 1
ReDim reportstring(x + 1, 4)
x = x + 1
DoEvents
Loop
Close #4
**** This is just to show me its working *****
Load frmError
iCopyString = ""
For i = 0 To cnt
For x = 0 To 4
iCopyString = iCopyString & reportstring(i, x) & " "
Next
iCopyString = iCopyString & vbCrLf
Next
frmError.Text1.Text = iCopyString
I am trying to move a csv file into a two dimensional array so that I can take the parts of the array I need along with other info and write it to a new file. Problem is I do not know the number of lines in the csv file (it changes daily)
can any help