+ Reply to Thread
Results 1 to 4 of 4

Error Reading Text File Line By Line

  1. #1
    Registered User
    Join Date
    07-25-2012
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    41

    Error Reading Text File Line By Line

    Hi All,
    I am reading eml files and write it to Excel.
    I use method reading line by line as follow:
    Please Login or Register  to view this content.
    The macro working fine so far but in certain case I got error
    Capture.JPG

    And error was on line

    Please Login or Register  to view this content.
    The input file is
    Please Login or Register  to view this content.
    It seems that “=” sign at the beginning of line creating the problem.
    After modify the code I got it work wihout any error.

    Please Login or Register  to view this content.
    My Question is: Are there any other way (better way then what I got here by adding “-“ sign at the beginning of the line which is start by “=” sign) to handle such a case?
    Your helps is greatly appreciated.

    Regards,
    Benny

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Error Reading Text File Line By Line

    Have you tried
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-25-2012
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    41

    Re: Error Reading Text File Line By Line

    Hi Jindon,
    I try your suggestion and it works fine for writing content of text file to excel.
    Moving a head one step, let say that I will read file one and write it in column 1 (several lines start with “=”). Next I read file two and write it in column 2(still with several line start with “=”).
    (for some reason those lines start with “=” are the same)
    I then compare column one and column two to get what is similar on both colums and the result written in column 3.
    What I notice so far:

    1. While using “’” & Data during reading text file and then compare column 1 and column 2 to get siimilarities I then fail to spot similarities in the line start with “=” which is already modify to “’” & data eventhough those lines are exactly similar in the reality.

    2. While using “-“ & data during reading text file and then compare column 1 and column 2 to get siimilarities I then fail can spot similarities in the line start with “=” which is already modify to “’” & data.

    Any idea why? I have been searching for hours but still couldn’t find any clear answer.


    Regards,
    Benny

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Error Reading Text File Line By Line

    I don't understand.

    In Excel, ' at the beginning plays nothing but make it as string, so you should be able to compare with or without it.

    eg.

    '=A1 should be equal to =A1 (cell formatted as text)

    Am I missing something?

    Otherwise, you can also format the cell as text before import.
    Last edited by jindon; 03-15-2018 at 05:52 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Reading line by line data from Text file
    By wyldencl in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-18-2015, 10:09 PM
  2. Replies: 12
    Last Post: 01-14-2014, 01:56 PM
  3. analyzing text file line by line
    By HarryKlein in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-16-2011, 12:20 PM
  4. Excel reading entire file, not one line at a time
    By verdugan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-24-2008, 01:37 PM
  5. [SOLVED] STart reading text file at line 2
    By Striker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-22-2006, 08:35 AM
  6. Reading a text file line by line-How do I open the text file with VBA
    By stressman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-16-2005, 12:29 AM
  7. Reading a text file line by line
    By Foss in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-16-2005, 12:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1