A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How copy text from one table to insert in another (w/o tbl structu



 
 
Thread Tools Display Modes
  #1  
Old October 18th, 2008, 09:06 PM posted to microsoft.public.word.tables
mkraft
external usenet poster
 
Posts: 50
Default How copy text from one table to insert in another (w/o tbl structu

I wanted to copy data from one table to another with the same table structure
(same number of rows/columns).

When I selected and copied the text from the first table and then inserted
it into the other, the entire table structure was included in the copy.

How can I prevent that -- i.e., how can I get only the text to insert into
the target table?

Thanks.
  #2  
Old October 18th, 2008, 09:29 PM posted to microsoft.public.word.tables
mkraft
external usenet poster
 
Posts: 50
Default How copy text from one table to insert in another (w/o tbl structu

I just want to clarify that I meant that the 2 tables had the same
'structure' from the get-go and that I wanted simply to transfer 'text' from
the second to the first.

My problem was that I could not find a way to transfer *only* the text.
When I inserted what I thought was only text in the second table, all the
table structure from the first table was also inserted along with it --
making a mess.

"mkraft" wrote:

I wanted to copy data from one table to another with the same table structure
(same number of rows/columns).

When I selected and copied the text from the first table and then inserted
it into the other, the entire table structure was included in the copy.

How can I prevent that -- i.e., how can I get only the text to insert into
the target table?

Thanks.

  #3  
Old October 18th, 2008, 10:01 PM posted to microsoft.public.word.tables
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default How copy text from one table to insert in another (w/o tbl structu

The following code in a macro will copy the content from the first table in
a document to the second table:

Dim Source As Table, Target As Table
Dim i As Long, j As Long
Dim crange As Range
Set Source = ActiveDocument.Tables(1)
Set Target = ActiveDocument.Tables(2)
With Source
For i = 1 To .Rows.Count
For j = 1 To .Columns.Count
Set crange = .Cell(i, j).Range
crange.End = crange.End - 1
Target.Cell(i, j).Range.Text = crange.Text
Next j
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"mkraft" wrote in message
...
I wanted to copy data from one table to another with the same table
structure
(same number of rows/columns).

When I selected and copied the text from the first table and then inserted
it into the other, the entire table structure was included in the copy.

How can I prevent that -- i.e., how can I get only the text to insert into
the target table?

Thanks.



  #4  
Old October 19th, 2008, 04:22 PM posted to microsoft.public.word.tables
Klaus Linke
external usenet poster
 
Posts: 401
Default How copy text from one table to insert in another (w/o tbl structu

Or if you copied say 2×3 cells to the clipboard, you'd need to select 2×3
cells first before you paste into the new table (... and create the new
cells beforehand if necessary).
Haven't tried it now, but that has worked for me in the past, and it is a
bit faster than transferring the individual cell contents.

Regards,
Klaus


"Doug Robbins - Word MVP" wrote:
The following code in a macro will copy the content from the first table
in a document to the second table:

Dim Source As Table, Target As Table
Dim i As Long, j As Long
Dim crange As Range
Set Source = ActiveDocument.Tables(1)
Set Target = ActiveDocument.Tables(2)
With Source
For i = 1 To .Rows.Count
For j = 1 To .Columns.Count
Set crange = .Cell(i, j).Range
crange.End = crange.End - 1
Target.Cell(i, j).Range.Text = crange.Text
Next j
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"mkraft" wrote in message
...
I wanted to copy data from one table to another with the same table
structure
(same number of rows/columns).

When I selected and copied the text from the first table and then
inserted
it into the other, the entire table structure was included in the copy.

How can I prevent that -- i.e., how can I get only the text to insert
into
the target table?

Thanks.




  #5  
Old October 19th, 2008, 06:47 PM posted to microsoft.public.word.tables
Suzanne S. Barnhill
external usenet poster
 
Posts: 31,786
Default How copy text from one table to insert in another (w/o tbl structu

I find that this works well pasting from Excel to Word but often fails
pasting Word to Word. Go figure.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

"Klaus Linke" wrote in message
...
Or if you copied say 2×3 cells to the clipboard, you'd need to select 2×3
cells first before you paste into the new table (... and create the new
cells beforehand if necessary).
Haven't tried it now, but that has worked for me in the past, and it is a
bit faster than transferring the individual cell contents.

Regards,
Klaus


"Doug Robbins - Word MVP" wrote:
The following code in a macro will copy the content from the first table
in a document to the second table:

Dim Source As Table, Target As Table
Dim i As Long, j As Long
Dim crange As Range
Set Source = ActiveDocument.Tables(1)
Set Target = ActiveDocument.Tables(2)
With Source
For i = 1 To .Rows.Count
For j = 1 To .Columns.Count
Set crange = .Cell(i, j).Range
crange.End = crange.End - 1
Target.Cell(i, j).Range.Text = crange.Text
Next j
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"mkraft" wrote in message
...
I wanted to copy data from one table to another with the same table
structure
(same number of rows/columns).

When I selected and copied the text from the first table and then
inserted
it into the other, the entire table structure was included in the copy.

How can I prevent that -- i.e., how can I get only the text to insert
into
the target table?

Thanks.






 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:19 PM.


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