1

Code :

var1 = "Hello"
var2 = "Dear"
var3 = var1 & vbNewLine & var2

Sheets("sheet_name").Cells(1, 1).Value = var3

If we take cell value in text file it looks like..

"Hello Dear"

I do not want double quotes surrounding the text.Could anyone suggest me for this issue.

Community
  • 1
  • 1
  • 1
    It's because of your line break. Why not just wrap the text instead? `Sheets("sheet_name").Cells(1, 1).WrapText = True` – Liss Oct 21 '15 at 19:09
  • When you "save as text", the quotes are inserted to indicate the `Cell Value` wraps onto multiple lines. What do you prefer to happen? – laylarenee Oct 21 '15 at 19:22
  • Possible duplicate of [Saving a Excel File into .txt format without quotes](http://stackoverflow.com/questions/11501531/saving-a-excel-file-into-txt-format-without-quotes) – laylarenee Oct 21 '15 at 19:23
  • @laylarenee I don't think it is a duplicate of that. That is saving the file. This is adding a value with a new line, then even if you just copy the cell contents and paste it to a text file it adds the double quotes. – MatthewD Oct 21 '15 at 19:29
  • 1
    That has nothing to do with your code though. Your code is fine. If you wrote in a cell, manually: `Hello Dear` and copy and pasted that into a text file you would get quotes. – JNevill Oct 21 '15 at 19:49
  • The quotation marks are being added when you "save as text file". I think that article is relevant. – laylarenee Oct 21 '15 at 20:02

0 Answers0