Home All Groups Group Topic Archive Search About

Read a text file word by word

Author
2 Mar 2006 12:05 PM
naiya
i have to develop a VB application which reads the text from a .txt
file, and i have to write the contents of the file to an Excel sheet.

the format of the .txt file is
name                 age                 company
abc                  23                  xyz
def                  18                  ghy   ... and so on

now when i load this data into an excel sheet, all diff information
shouls appear in different cells of the excel sheet.
Please help

Author
2 Mar 2006 12:11 PM
Patrice
What is the field separator ? What is the problem ?

You could read each line use the Split method to break down hte line fields
(the separator is a tab ?)

As a side note, Excel is able to read tab delimited files...

--
Patrice

Show quoteHide quote
"naiya" <gupta.na***@gmail.com> a écrit dans le message de
news:1141301107.614206.52990@p10g2000cwp.googlegroups.com...
> i have to develop a VB application which reads the text from a .txt
> file, and i have to write the contents of the file to an Excel sheet.
>
> the format of the .txt file is
> name                 age                 company
> abc                  23                  xyz
> def                  18                  ghy   ... and so on
>
> now when i load this data into an excel sheet, all diff information
> shouls appear in different cells of the excel sheet.
> Please help
>
Author
2 Mar 2006 1:41 PM
Andrew Morton
Patrice wrote:
> As a side note, Excel is able to read tab delimited files...

....and if you give them an extension of .xls it will open them without
complaint. You can even use formulae in the tab-delimited file, like =A2+B2
or =second(now())

Andrew
Author
3 Mar 2006 5:32 AM
naiya
dear Patrice

plz tell me the syntax of the split method. the seperator is a tab.

Naiya
Author
3 Mar 2006 6:44 AM
Homer J Simpson
"naiya" <gupta.na***@gmail.com> wrote in message
news:1141363933.408532.167210@z34g2000cwc.googlegroups.com...

> plz tell me the syntax of the split method. the seperator is a tab.

Split("My line", Chr(9))