View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Read data from ascii file

Iinput# is designed to read comma delimited data. You data is not comma
delimited.

You will need to use Line Input into a text string and parse it.

You could do this with the split statement if you are using xl2000 or later.

--
Regards,
Tom Ogilvy

"Nazrul" wrote in message
...
I'd like to read a ascii file using VBA and the file has
(for example):
------------------------------------------------
Name Group Measured Modelled
d311 obsgroup 0.3270859 0.2853140
d312 obsgroup 0.3436139 0.3403970
--------------------------------------------------------
I have written:
dim dataname, groupname as string
Dim meas, modell as double

Line Input #1, textline ' Read text line
Do While Not EOF(1) ' Loop until end of file.
Input #1, dataname, groupname, meas, modell
Count = Count + 1
Loop
*******
But the variables does not read correctly. Could you help
me?

Nazrul