Group: microsoft.public.word.vba.general
From: =?Utf-8?B?QWxleCBTdC1QaWVycmU=?=
Date: Tuesday, March 18, 2008 10:14 AM
Subject: RE: Copy a row inside an other table

Thank's a lot. It works very well.
I'm wondering if there are 2 rows to copy from table #1 to table #2 (first
two row), is it possible to copy the 2 rows at the same time by setting
rowCopy equal to the first two rows?
Alex
--
Alex St-Pierre


"Jean-Guy Marcil" wrote:

> "Alex St-Pierre" wrote:
>
> > Hi!
> > I split a table into a lot of pages using macro and I would like to
> > copy-paste the first row of table#1 at the top of table #2, etc.
> > Something like the following but using the object method.
> > Thank you!
> > Alex
> > docWord.Tables(2).Rows.Add BeforeRow:=oRange.Tables(2).Rows(1)
> > docWord.Tables(1).Rows(1).Range.Select
> > Selection.Copy
> > docWord.Tables(2).Rows(1).Range.Select
> > Selection.Paste 'Gives error 438..
>
> Try something like this:
>
> Dim tblPaste As Table
> Dim i As Long
> Dim rowCopy As Row
>
> With ActiveDocument
> Set rowCopy = .Tables(1).Rows(1)
> For i = 2 To .Tables.Count
> With .Tables(i)
> .Rows.Add (.Rows(1))
> .Rows(1).Range.FormattedText = rowCopy.Range.FormattedText
> .Rows(2).Delete
> End With
> Next
> End With
>