MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Copy without Carriage Return

  Asked By: Kehkashan    Date: Jan 09    Category: MS Office    Views: 5937

If I do


if cell a1 has a value of 'this is summer', when I go to Word (or
other applications) and do Ctrl+V (paste), I get
2 lines as follows:

(1) this is summer
(2) <blank>

This must be because the carriage return key was also copied when I
did Selection.Copy

How do I just copy without the carriage return key, so that I could
paste it in Word and get only 1 line: (1) this is summer



3 Answers Found

Answer #1    Answered By: Archie Parker     Answered On: Jan 09

I don't think it is a case of copying the carriage  return but more of a case
of Word keeping formatting with the text. Word keeps formatting in
paragraph markers, so if you do a PasteSpecial using Unformatted text your
results will not have the paragraph marker.

Selection.PasteAndFormat (wdFormatPlainText)

Answer #2    Answered By: Hamdan Younis     Answered On: Jan 09

The trouble with Excel's "Copy with Carriage Return" trouble can be
verified by going into any text editor and do paste, we would get 2
lines. Therefore this is not a Word formatting problem alone.
Also, most text editor do not have capability to do such thing as
PasteSpecial using Unformatted. Therefore, we are forced to fix the
problem at Excel side.

One other observation: if I select a cell  and do copy, I get 2 lines
when I do paste  later in Word or any other text editor. But if I
select a cell and go inside the cell, highlight the text and do
COPY...I get only 1 line  when I do paste later in Word or any other
text editor. This shows that just copy  a cell or copy text inside a
cell produced different results.

Answer #3    Answered By: Laaibah Malik     Answered On: Jan 09

I did the following 3 tests:

(1) the following will copy  with carriage  return and verified in
Dim x As New DataObject


z = x.GetText
MsgBox ("..." & z & "...")

(2) the following will copy with no carriage return  and verified in

Dim x As New DataObject
Dim y As New DataObject

x.SetText "aaaaaa"

z = y.GetText
MsgBox ("..." & z & "...")

(3) the following will copy with no carriage return and verified in
Dim x As New DataObject
Dim y As New DataObject'

x.SetText ActiveCell.Text

z = y.GetText
z = "" & z & ""
MsgBox ("..." & z & "...")

====> The above test #3 is near the final answer for me, except that
I can paste  the clipboard to any text editor in test #2, but not in
test #3...

Didn't find what you were looking for? Find more on Copy without Carriage Return Or get search suggestion and latest updates.