
July 22nd, 2003, 10:07 AM
|
 |
Contributing User
|
|
Join Date: Jul 2003
Posts: 206
Time spent in forums: 19 h 29 m 24 sec
Reputation Power: 6
|
|
|
copy tables in a new word document
Hi all,
I try to copy the first and the last table of an existing word document in a new word document.
The problem is that the first table is always overwritten by the last one.
I tried it in that way:
Code:
tableCounter = 0
For Each aTable In ActiveDocument.Tables
tableCounter = tableCounter + 1
If (tableCounter = 1 or tableCounter = ActiveDocument.Tables.Count)
aTable.Select
Selection.Copy
Selection.EndKey Unit:=wdStory ' go at the end of the doc
Selection.TypeText ("Table foo")
Selection.EndKey Unit:=wdStory ' go at the end of the doc
Documents("newdoc.doc").Content.Paste
Selection.EndKey Unit:=wdStory
Documents("newdoc.doc").Content.InsertParagraphAfter
End If
Next
Could anyone help me?
Thanks in advance
Oliver
|