+ Reply to Thread
Results 1 to 6 of 6

Txt format problem - quotes missing

  1. #1
    Registered User
    Join Date
    08-16-2007
    Posts
    50

    Txt format problem - quotes missing

    Hello all,

    I'm trying to write a macro that opens a text file, copies it, then pastes the values into the original workbook. I got it working, but when the it pastes the text, excel stripes out double quotes. I tried using Format:="Unicode Text", but got errors. I also tried pasting values only, but that didn't work either. The code I'm using is below and the spreadsheet I'm using to test this are attached. Any help would be appreciated.

    Thanks!

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mcclanat; 09-06-2011 at 06:13 PM.

  2. #2
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: Txt format problem - quotes missing

    attach example of source text file too

    Best Regards

  3. #3
    Registered User
    Join Date
    08-16-2007
    Posts
    50

    Re: Txt format problem - quotes missing

    The text file I was using to test the macro is attached below with a .txt extension because .inp extentions are not approved as attachments for this website. An inp file is an input file for energy simulation software. It is just a text file that is saved with a .inp extension so the software will read it. You can open the attached example file and save it with a .inp on the end. I tested the macro above with both .inp and .txt extensions, and it striped the double quotes out in both cases.

    If I manaully copy and paste the information, then select text import wizard, delimited, text qualifier = none, the code pastes correctly. However, I haven't been able to duplicate this with VBA code. I tried recording a macro and it used Format:="Unicode Text", but I got errors when I tried that.
    Attached Files Attached Files

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,509

    Re: Txt format problem - quotes missing

    Try:

    Please Login or Register  to view this content.


    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    08-16-2007
    Posts
    50

    Re: Txt format problem - quotes missing

    That worked. Thank you!

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,509

    Re: Txt format problem - quotes missing

    You're welcome. Thanks for the rep.

+ Reply to 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