Consulting

Results 1 to 3 of 3

Thread: Solved: VBA SaveAs xlTextMSDos creates (sometimes) quote marks

  1. #1
    VBAX Regular Felix Atagong's Avatar
    Joined
    Jun 2004
    Location
    Louvain, Belgium
    Posts
    29
    Location

    Solved: VBA SaveAs xlTextMSDos creates (sometimes) quote marks

    I've got an annoying problem. A macro generates a flat-text file using the command

    ActiveWorkbook.SaveAs Filename:= "Export.txt", FileFormat:=xlTextMSDOS

    The generated text file has on some lines a starting and ending quote mark, and on others, with the same length and with exactly the same start and ending sequence, not.

    For instance:
    P000000xxxxx700characters00000 vs.
    "P000000xxxxx700characters00000"

    I can't save as xlTextPrinter as my strings are too big (715 characters) and that fileformat cuts the strings in smaller substrings. XLTextWindows also creates quote marks on some of the lines.

    I really can't find a reason why these quote marks are generated, but they are always generated on the same line. So there is a consistency in the error.

    Any ideas?
    Felix Atagong
    Unfinished Projects

  2. #2
    Moderator VBAX Mentor sheeeng's Avatar
    Joined
    May 2005
    Location
    Kuala Lumpur
    Posts
    392
    Location
    I face this similar problem before...

    Solved: Extra Double Quote when Export String to Text File
    http://www.vbaexpress.com/forum/showthread.php?t=3357

    HTH.

  3. #3
    VBAX Regular Felix Atagong's Avatar
    Joined
    Jun 2004
    Location
    Louvain, Belgium
    Posts
    29
    Location
    I think (still got to test it) I found it. The lines with a quote mark around, have a comma (,) somewhere in the data, for instance in an address field.

    So I think that
    Brussels street 10
    is transformed into
    Brussels street 10 but
    Brussels street , 10 into
    "Brussels street, 10" .

    Added a few minutes later: YES THAT'S IT!
    Felix Atagong
    Unfinished Projects

Posting Permissions

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