Home > Archive > Visual Basic Syntax > March 2006 > Visual Basic Excel Reading in Comma Delimited Text Files
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Visual Basic Excel Reading in Comma Delimited Text Files
|
|
| Smeg-Head 2006-03-13, 11:16 am |
| I am new to VBA- specifically in excel. I am able to open file, read file, and close file. Each line read has several “cells” of data. However, the testfile.txt is comma delimited.
Basically, I have a database.txt file which contains information that I wish to use for updating my database(worksheet). I need an easy, quick, and clean way to:
Worksheets("Sheet1").Cells.ClearContents
Open "C:\testfile.txt" For Input As #1
Read in the contents of the comma delimited file to Worksheets("Sheet1")
Close #1
I realize that this may not be the right place to ask for assistance within excel. If true, my apologies. Could you direct me to where I might ask? | |
| Hemant_india 2006-03-14, 3:58 am |
| why not directly import a fiel in excel sheet
however code would be like this....
dow ehile eof(1)
linput line #1, some variable
here use split function (see in ve help)
loop
--
hemu
"Smeg-Head" wrote:
>
> I am new to VBA- specifically in excel. I am able to open file, read
> file, and close file. Each line read has several “cells” of data.
> However, the testfile.txt is comma delimited.
>
> Basically, I have a database.txt file which contains information that I
> wish to use for updating my database(worksheet). I need an easy, quick,
> and clean way to:
>
> Worksheets("Sheet1").Cells.ClearContents
> Open "C:\testfile.txt" For Input As #1
> Read in the contents of the comma delimited file to
> Worksheets("Sheet1")
> Close #1
>
> I realize that this may not be the right place to ask for assistance
> within excel. If true, my apologies. Could you direct me to where I
> might ask?
>
>
>
> --
> Smeg-Head
> ------------------------------------------------------------------------
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------
>
>
| |
| Jeff Johnson [MVP: VB] 2006-03-14, 7:02 pm |
|
"Smeg-Head" <Smeg-Head.24mwxr@mail.codecomments.com> wrote in message
news:Smeg-Head.24mwxr@mail.codecomments.com...
> I realize that this may not be the right place to ask for assistance
> within excel. If true, my apologies. Could you direct me to where I
> might ask?
Excel-specific questions should go to microsoft.public.excel.programming. I
have to wonder why you aren't using Excel's built-in ability to read
comma-delimited files....
|
|
|
|
|