Hi
Here is an example.
Sub ImportData()
'Filename = the full path to Your txt file eg."C:\MyDocuments\Mytxt.txt"
Open Filename For Input As #1
Do While (Not EOF(1))
' In this case the file is delimited by , and contains several lines
' Read the file one line at the time
Input #1, Streng
'Input streng into and array
StrArray = Split(Streng, ",")
Call WriteToExcel(StrArray)
Loop
Close #1
End Sub
Sub WriteToExcel(StrArray)
For J = LBound(StrArray) To UBound(StrArray)
'Do what you want to do with the data
Next J
End Sub
Hope this is what you are looking for.
Cheers
Karsten
|