Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 40
Default char(10) and double quotes

When I put in the following, I get the expected result in the cell. However,
when I cut and paste the cell value to notepad or any other text editor I get
double quote marks around text.

="line1"&CHAR(10)&"line2"

Shows no double quotes markes in Excel, but cut and paste to notepad shows
double quote marks:

"line1
line2"

Is there a way to prevent these superfluous double quote marks when doing a
cut/paste to a text editor?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,203
Default char(10) and double quotes

Probably not easily - I duplicated your situation. Also when I put
line1 in cell A4
line2 in cell A5 and in
A6 put the formula =A4 & Char(10) & A5
the result over in Notepad was the same: "line1 [squarebox] line2"


"JohnE" wrote:

When I put in the following, I get the expected result in the cell. However,
when I cut and paste the cell value to notepad or any other text editor I get
double quote marks around text.

="line1"&CHAR(10)&"line2"

Shows no double quotes markes in Excel, but cut and paste to notepad shows
double quote marks:

"line1
line2"

Is there a way to prevent these superfluous double quote marks when doing a
cut/paste to a text editor?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default char(10) and double quotes

You could use a macro.

Saved from a previous post:

I used the PutInClipboard routine that Chip Pearson has:
http://www.cpearson.com/excel/clipboard.htm

With this sub:
Option Explicit
Sub testme()

Dim MyDataObj As DataObject
Set MyDataObj = New DataObject

MyDataObj.SetText ActiveCell.Text
MyDataObj.PutInClipboard

End Sub

And then pasted (manually) into NotePad. No double quotes were inserted. But I
did see a little square where the alt-enter was.

Chip has instructions that you have to follow (including the tools|references
with "Microsoft Forms 2.0 object library") on that sheet.

=========

If you wanted to copy multiple cells, this may help you:

Option Explicit
Sub testme()

Dim MyDataObj As DataObject
Dim myCell As Range
Dim myRow As Range
Dim myRng As Range
Dim myRowStr As String
Dim myStr As String

Set MyDataObj = New DataObject

Set myRng = Selection.Areas(1)

myStr = ""
For Each myRow In myRng.Rows
myRowStr = ""
For Each myCell In myRow.Cells
myRowStr = myRowStr & vbTab & myCell.Text
Next myCell
myRowStr = Mid(myRowStr, Len(vbTab) + 1) 'get rid of leading vbtab
myStr = myStr & vbCrLf & myRowStr
Next myRow
myStr = Mid(myStr, Len(vbCrLf) + 1) 'get rid of leading vbcrlf (2 chars!)

MyDataObj.SetText myStr
MyDataObj.PutInClipboard

End Sub

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

JohnE wrote:

When I put in the following, I get the expected result in the cell. However,
when I cut and paste the cell value to notepad or any other text editor I get
double quote marks around text.

="line1"&CHAR(10)&"line2"

Shows no double quotes markes in Excel, but cut and paste to notepad shows
double quote marks:

"line1
line2"

Is there a way to prevent these superfluous double quote marks when doing a
cut/paste to a text editor?


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Double Quotes [email protected] New Users to Excel 2 July 20th 08 12:43 PM
Double Quotes PeterM Excel Discussion (Misc queries) 5 June 17th 08 05:12 PM
concatenate, char(10), and double quotes steve Excel Discussion (Misc queries) 3 August 22nd 07 04:42 AM
CHAR funtcion with double letter columns ellebelle Excel Worksheet Functions 7 July 16th 07 03:05 PM
Double quotes when concatenating with CHAR(10) [email protected] Excel Discussion (Misc queries) 0 September 22nd 06 09:57 PM


All times are GMT +1. The time now is 10:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"