Try this amended code;<pre/>
Sub ReadtextIntoArray()
'Damon:
'Thanks for your reply.
'I have come up with the following which reads the file ok,
'but I need to put it in an array and not in a single variable.
'The data consists of 537 lines in each file.
'I need to put each line into a new element in the array.
'Any further thoughts.
Dim TextArray()
Dim x As Double
Sheets("Test").Select
Open "C:QP2-SSG-NAICSSGC.SSG" For Input As #1 ' Open file.
Do While Not EOF(1) ' Loop until end of file.
ReDim Preserve TextArray(x) ' Preserve the Array
Line Input #1, TextArray(x) ' Read line into variable.
x = x + 1 ' increment array count
Loop
Close #1 ' Close file.
For x = 0 To UBound(TextArray())
MsgBox TextArray(x) 'Test to see if we have the variables
Next
End Sub</pre>
_________________
Kind Regards,<font size=+2><font color="red"> I<font color="blue">van<font color="red"> F M</font color="blue">oala</font></font></font><A HREF= "http://www.gwds.co.nz/"><font color="green">
http://www.gwds.co.nz/excel_files.html - Under Constru
This message was edited by Ivan F Moala on 2002-04-19 19:56