I have problem with passing data from txt file to array. I have word document which needs to be filled with data from txt file.
Private Function ReadString() As String
Dim textArray() As String
Dim data As String
Open "C:\Data\XFile.ini" For Input As #1
r = 0
Do Until EOF(1)
ReDim textArray(0 To r)
Line Input #1, data
textArray(r) = data
r = r + 1
Loop
ReadString = textArray(77)
' MsgBox ReadString
' MsgBox "After"
Close #1
End Function
I need data from line 78, but something is wrong in my code and data is not passed from file to array. If anybody can point out problem I would be very thankful.