PDA

View Full Version : Solved: VBA SaveAs xlTextMSDos creates (sometimes) quote marks



Felix Atagong
07-05-2005, 07:22 AM
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?

sheeeng
07-05-2005, 07:44 AM
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.

Felix Atagong
07-05-2005, 07:46 AM
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!