0

Stackoverflow folk!

I am having a funny double-quote issue with Excel. I am attempting to generate some XML code in a cell that I then copy/paste into a plain-text editor to save (in this case, Notepad).

So, these work as expected:

="hello ""world"", folks!"

and

="hello "&CHAR(34)&"world"&CHAR(34)&", folks!"

each output hello "world", folks! as expected, and copy/paste into Notepad just fine.

However, as soon as I add a line break, as in the following two examples:

="hello ""world"", folks!"&CHAR(13)

or

="hello "&CHAR(34)&"world"&CHAR(34)&", folks!"&CHAR(13)

The output looks fine in Excel, but upon copy/paste into Notepad, I get a problematic result

"hello ""world"", folks!"

I obviously can't have random extra double-quotes floating around in my final XML, but I can't see a way to get my output without them. Does anyone have any ideas?

Thanks in advance!

Ben I.
  • 1,065
  • 1
  • 13
  • 29
  • Seems like the copy-paste is designed to allow for escaping new lines in CSV/tab-delimited content: you'll see the same behaviour if you add a tab The quotes are added because there's a newline/tab in the text. Why do you need to add the line breaks? Just for readability? – Tim Williams Aug 17 '15 at 16:18
  • This was just some sample code to illustrate the problem; the final XML is quite long, and wouldn't be maintainable without good spacing and indentation. – Ben I. Aug 17 '15 at 17:13
  • There doesn't seem to be any way around this without some VBA for example. Something like http://stackoverflow.com/questions/14219455/excel-vba-code-to-copy-a-specific-string-to-clipboard – Tim Williams Aug 17 '15 at 17:45

0 Answers0