Reading data from CSV file

J

Jacob

I'm trying to create a program using VBA within excel that will read
specific data from a user specified CSV file. I would like the user to
browse for and select the CSV file, and once selected, the program
imports only the required variables from the file into the program to
be used. ideally, this would be done without having to physically open
the CSV file. it would just read it. is this something that an amateur
VBA programmer could handle? does anyone have any advice or
suggestions for me, to point me in the right direction. i am able to
create a diolog box to open a CSV file, but that's about it so far.

thanks!
 
J

JL

Thanks, Steve. I'll have to look at your suggestion a little closer
when i get some time. i'm not that very familiar with this language.
the CSV file will be output from an engineering program. i'd like to
take specific values that are in the file and run them through a
program to get results. searching for, and getting all the values
from the file will be another issue, but i just want to make sure that
i can get them out and into an array or something. once i get them
in, i shouldn't have trouble writing the algorithms. can the csv file
be treated as an excel file as when it is opened in excel? in other
words, will i be able to reference cells within the csv file as though
i was referencing a cell on a sheet?
 
G

GS

I do exactly what you describe here using ADO and treating the CSV file as a
database table. This does not require opening the file and allows you to
specify exactly what values you want to extract. (Assumes the first line in
the file contains fields, all other lines contain relative data for those
fields)

HTH
Garry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top