Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Re: CSV input file


Message #1 by John Stendor <john.stendor@c...> on Fri, 14 Jun 2002 14:14:02 -0400
Would the Input # statement work for this?
open the file for input and loop thru each line reading the variables

From the vb help

Input # Statement Example
This example uses the Input # statement to read data from a file into two
variables. This example assumes that TESTFILE is a file with a few lines of
data written to it using the Write # statement; that is, each line contains
a string in quotations and a number separated by a comma, for example,
("Hello", 234).

Dim MyString, MyNumber
Open "TESTFILE" For Input As #1   ' Open file for input.
Do While Not EOF(1)   ' Loop until end of file.
   Input #1, MyString, MyNumber   ' Read data into two variables.
   Debug.Print MyString, MyNumber   ' Print data to the Immediate window.
Loop
Close #1   ' Close file.


Manhal M Shukayr
mshukayr@r...


River Cities Software

----- Original Message -----
From: "Judy Henry" <henryjud@n...>
To: "professional vb" <pro_vb@p...>
Sent: Thursday, June 13, 2002 4:53 PM
Subject: [pro_vb] CSV input file


> I have a comma separated file created through an excel database. Is there
an easy way to read the file and break out the different fields?
>
> Thanks
>
> Judy
>
>
>



  Return to Index