PDA

View Full Version : Why ,after Copy and Paste a formatted table text, is this table nested



silvkhan
10-10-2012, 06:59 AM
Why ,after Copy and Paste a formatted table text which is the content of a cell, is this table nested inside another table in the new doc?
I copy, with the code below shown, the contents of a table cell and paste it into a new word doc.
I get two different results:
1) if the cell's text has no table, the copy and paste gives a new content not nested inside a table
as it must be correctly
2) if the cell's text has a table, the copy and paste gives a new content which reproduce correctly the cell's content: that table together with other
text, but places all this content inside a new table, I get two nested tables.

Dim oDoc1 As Word.Application
Dim doc2 As Word.Document
Set doc2 = oDoc1.Documents.Add
With oDoc1.ActiveDocument
Set cella = .Range(Start:=.Tables(2).Cell(k, 3).Range.Start, _
End:=.Tables(2).Cell(k, 3).Range.End)

End With
cella.Select
oDoc1.Selection.Copy
doc2.Range.PasteAndFormat (wdPasteDefault)

silvkhan
10-14-2012, 10:56 AM
The wrong behavior is:
1) I copy, by ctrl-c, the cell content of a table
2) I paste, by ctrl-v, this content on an empty word doc
3) If that content does not contain an other table, the copy and paste is right
else the copy and paste is wrong for that copied content contains also an other frame table around it.
Is it a ms word software bug?