Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Import File Line by Line

Hi All,

I have written a function that will open a delimited file, read it
line by line and copy it into different rows under column A of a
sheet. Once it is done, I then compute the last row of data in the
sheet and then to a 'Text to Columns' from A1 to A LastRow.

But the file I import could have fields that are Unicode. So I have a
file that has a text like 'č'. The ASCII value for it is 269. The
macro replaces this 'č' character with a new line. I think that is
because after 255, the count starts from 0 again and since Chr(13) is
the character for carriage return it adds the text to a new line. Do
you have any idea as to how to stop the function from doing this. I do
not want to read the file character by character since the contents
could be really large.

Thanks in advance,
Haarish.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Import File Line by Line

You have only tow choices.

1) Open the file as binary reading the data as words (not bytes) reading the
data one word at a time. Text to columns won't work since the delimiter
characters are now 16 bits instead of 8 bits.

2)Open the file as text and use Text to Columns. You will loose the unicode
characters.


You can open as binaray and use READALL but you will still have to process
the data after you get into excel.

"Haarish" wrote:

Hi All,

I have written a function that will open a delimited file, read it
line by line and copy it into different rows under column A of a
sheet. Once it is done, I then compute the last row of data in the
sheet and then to a 'Text to Columns' from A1 to A LastRow.

But the file I import could have fields that are Unicode. So I have a
file that has a text like 'č'. The ASCII value for it is 269. The
macro replaces this 'č' character with a new line. I think that is
because after 255, the count starts from 0 again and since Chr(13) is
the character for carriage return it adds the text to a new line. Do
you have any idea as to how to stop the function from doing this. I do
not want to read the file character by character since the contents
could be really large.

Thanks in advance,
Haarish.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Import XML into Excel just get first line (=file) ClaesWedin Excel Programming 1 March 9th 07 03:25 PM
Import & Parsing a small 400 line CSV file tarns[_8_] Excel Programming 3 March 13th 06 02:38 AM
Text File Import leaves a blank row after each line R Kapoor Setting up and Configuration of Excel 0 January 8th 06 02:07 PM
import huge text file line-by-line? rachel Excel Programming 2 November 6th 04 04:43 PM


All times are GMT +1. The time now is 10:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"