after i do

activedocument.tables(1).range.copy

how should i go about pasting it to the end of the document?

Is there a better/faster way to copy a table to the end of the document?

Thanks!!

Re: Copy Table to End of Document by Helmut

Helmut
Thu Jun 24 11:30:07 CDT 2004

Hi Sonny,
have a look at this one:
Sub Test556()
Dim oDcm As Range
Set oDcm = ActiveDocument.Range
oDcm.Tables(1).Range.Copy
oDcm.Collapse direction:=wdCollapseEnd
oDcm.Paste
End Sub
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98

Re: Copy Table to End of Document by Jay

Jay
Thu Jun 24 11:43:19 CDT 2004

Sonny Maou wrote:
> after i do
>
> activedocument.tables(1).range.copy
>
> how should i go about pasting it to the end of the document?
>
> Is there a better/faster way to copy a table to the end of the
> document?
>
> Thanks!!

Hi Sonny,

If you use the Copy method, it goes like this:

ActiveDocument.Tables(1).Range.Copy
Selection.EndKey unit:=wdStory
Selection.Paste

I don't care for that method, for two reasons: (1) If you had something on
the clipboard that you wanted to keep, it's replaced by the table, and (2)
it moves the cursor to the end of the document.

A better method IMHO is to use a Range object collapsed to the end of the
document, and just assign the table's .FormattedText to it:

Dim oRg As Range
Set oRg = ActiveDocument.Range
oRg.Collapse wdCollapseEnd
oRg.FormattedText = _
ActiveDocument.Tables(1).Range.FormattedText

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org



Re: Copy Table to End of Document by Sonny

Sonny
Thu Jun 24 12:32:13 CDT 2004

Jay Freedman wrote:

> Sonny Maou wrote:
>
>>after i do
>>
>> activedocument.tables(1).range.copy
>>
>>how should i go about pasting it to the end of the document?

> A better method IMHO is to use a Range object collapsed to the end of the
> document, and just assign the table's .FormattedText to it:
>
> Dim oRg As Range
> Set oRg = ActiveDocument.Range
> oRg.Collapse wdCollapseEnd
> oRg.FormattedText = _
> ActiveDocument.Tables(1).Range.FormattedText

Exactly what I was looking for... Thanks Jay.

(And thanks Helmut for your input, too! :) )