Closed Thread
Results 1 to 5 of 5

Problem importing text file using macro

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Problem importing text file using macro

    All:

    I created a vb macro to open a text file then process the file then close the file. Here is my problem:

    Problem: The text file has rows of data in it as follows

    5155111111551511111111111511111111111111111

    This row of text gets converted to an exponential such as the following:

    5.16E+42

    because excel treats the row of text as a number but i dont want it to do this transition.

    When i save the file and then reopen it using say NOTEPAD i see 5.16E+42 and not the long string of text.

    Is there a solution to this?

    Any help would be appreciated.


    David

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    Can you expand further, please, on what sort of processing Excel is being asked to do by the macro. A code snippet would be useful.
    Martin

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662
    Here is a code snipet of opening the file.


    Please Login or Register  to view this content.

    After i open the file i convert all "N" to "." then save and close the file.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    welchs101 or is it DHolcombe

    Please read forum rules below and then add the link to the cross post on the other forum

    VBA Noob
    Last edited by VBA Noob; 12-01-2007 at 05:43 PM.
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    It works.

    Sorry about the cross forum violation.

    Wont happen again.

    But did want to let everyone know that Norie solved my problem.

    The 3rd dialog box on the import text dialog box make sure to check text and everything works great.

    Thanks again.

    David

Closed Thread

Thread Information

Users Browsing this Thread

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

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