Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a *.csv file that I would like to read depending on a list of lines
that I have. I was wondering how I can do that. Eg. I want to read line 300, 202, .... can I just jump to the line I want and read it? How can I accomplish this if I cannot read it from any line? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On variable length lines, you cannot just "skip around" as you are asking.
However, you could make a routin to simulate this by making small use of the SEEK command to reset the position back to the top of the file. private function readaline(hFilePtr as long, intRowNumber as long) as string dim vLine as variant, iLoop as long 'Move to beginning of file (vastmseek.htm) Seek hFileptr, 1 iloop=0 do while not eof(hFilePtr) iloop = iloop + 1 line input #hfielptr, vLine if iLoop =IntRowNumber exit do else vline="" 'Clear any bad data end if loop readaline=cstr(vLine) end function HTH "WannaBeExceller" wrote in message ... I have a *.csv file that I would like to read depending on a list of lines that I have. I was wondering how I can do that. Eg. I want to read line 300, 202, .... can I just jump to the line I want and read it? How can I accomplish this if I cannot read it from any line? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you very much AMDRIT. It worked like magic! Thank you.
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
reading from another file and pasting to current file, "combobox" | New Users to Excel | |||
reading data from 2nd file in 1st file using Combobox | Excel Programming | |||
reading from text file to excel file | Excel Programming | |||
Reading from ini file | Excel Programming | |||
Reading from file | Excel Programming |