+ Reply to Thread
Results 1 to 8 of 8

SaveAs .txt extension, but need format without quotes

  1. #1
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    384

    SaveAs .txt extension, but need format without quotes

    I have created a spreadsheet in the exact format that I want but when in VBA code I save it as a .txt file I end up with quotes that are not what I desired. The following is the desired format.

    Please Login or Register  to view this content.
    I use the following code to save the file:
    Please Login or Register  to view this content.
    When I open the text file I get this with extra quotes:
    Please Login or Register  to view this content.
    I have tried many different formats in the code:
    Please Login or Register  to view this content.
    with xlText being varied. Any ideas?
    Last edited by Bobbbo; 10-02-2017 at 12:44 PM. Reason: Mark it solved

  2. #2
    Valued Forum Contributor Maudibe's Avatar
    Join Date
    12-21-2016
    Location
    USA
    MS-Off Ver
    2010-2013
    Posts
    326

    Re: SaveAs .txt extension, but need format without quotes

    One approach is to send line by line to text file using the print method as opposed to write method because it does not add the double quotes like write does. Are each of your lines above the contents of one cell?

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

    Re: SaveAs .txt extension, but need format without quotes

    This should remove extra double quotes from txt file.
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    384

    Re: SaveAs .txt extension, but need format without quotes

    Quote Originally Posted by Maudibe View Post
    One approach is to send line by line to text file using the print method as opposed to write method because it does not add the double quotes like write does. Are each of your lines above the contents of one cell?
    Thanks Maudibe, If I save the format = xlTextPrinter it gets me closer but lhe lines are too long and I get a Charage Return at the "Inventory" that is not desired.

  5. #5
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    384

    Re: SaveAs .txt extension, but need format without quotes

    Quote Originally Posted by jindon View Post
    This should remove extra double quotes from txt file.
    Please Login or Register  to view this content.
    Looks interesting let me see if I adapt this code for my application. Thanks!

  6. #6
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    384

    Re: SaveAs .txt extension, but need format without quotes

    Quote Originally Posted by jindon View Post
    This should remove extra double quotes from txt file.
    Please Login or Register  to view this content.
    Hi jindon, I have it working as planned but I have a list of 1900 of these text files all in the same folder I have to process. I am trting to make the file to open a variable. I replaced one line in your code to:
    Please Login or Register  to view this content.
    where "mypath" is the path to the directory and "myval" is the name of the file. It does not work. Any ideas?

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

    Re: SaveAs .txt extension, but need format without quotes

    Try change like this
    Your code
    Please Login or Register  to view this content.
    And change to
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    384

    Re: SaveAs .txt extension, but need format without quotes

    Quote Originally Posted by jindon View Post
    Try change like this
    Your code
    Please Login or Register  to view this content.
    And change to
    Please Login or Register  to view this content.
    Hi jindon, WOW I am impressed. Your VBA coding skills are very impressive. I made the changes you suggested and the VBA code ran without and issues. Thank you so much!!!

+ 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. Format or file extension is not valid
    By chambers55 in forum Excel General
    Replies: 4
    Last Post: 02-15-2017, 04:14 AM
  2. the file format and extension of don't match...
    By m.zaeim in forum Excel General
    Replies: 2
    Last Post: 01-02-2017, 05:53 PM
  3. file format or extension is invalid
    By Robertb9441 in forum Excel General
    Replies: 1
    Last Post: 10-07-2016, 12:30 AM
  4. Replies: 1
    Last Post: 05-28-2013, 07:56 PM
  5. Excel 2010: Different format than specified by the file extension.
    By jambai in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-02-2011, 10:54 AM
  6. Txt format problem - quotes missing
    By mcclanat in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-06-2011, 06:15 PM
  7. Different format than specified by the file extension
    By cproctor in forum Excel General
    Replies: 10
    Last Post: 05-10-2011, 11:53 AM

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