I use the following code to copy 1 line of text file to 1 index of array.
It needs to be updated like this:Code:Public Sub CopyFileToArray(zarray As Variant, filename As String, maxlines As Integer)
Dim LinesFromFile As String, NextLine As String
Open filename For Input As #1
For xi = 1 To maxlines
Line Input #1, NextLine
LinesFromFile = LinesFromFile + NextLine + Chr(13) + Chr(10)
zarray(xi) = NextLine
Next
Close #1
End Sub
Before the array was like this- Array(1 to x) as string
Now it's like this- Array(1 to x,1 to y, 1 to z, 1 to a) as string
I 've separated the information the program needs to get from text file with commas(,).
Example, again-
info1,info2,info3,info4
x y z a
The sub needs to read the text that is separated by commas and write it to the array's corresponding indices. How to do that?
(Hope you got it, I'm not good to explain things as you can see :))
