First off, declaring a Range does indeed use a Start, and and End. However,
Start:=tbl3.Cell(13, 1) is NOT a valid value for a Range value. Thus: Type
Mis-match
Start:= needs to be a NUMBER
tbl3.Cell(13, 1) is NOT a number, it is a cell.
Second, I do not know what your other code is like, but I would guess that it
could probably run better using objects. This is a simple example. An
active document, and an already open (but NOT active) document named "Yadda".
The code makes a table object of the third table in the active document, and
a table object in the target document ("Yadda").
Dim ThisDoc As Document
Dim ThatDoc As Document
Dim SourceTable As Table
Dim TargetTable As Table
Set ThisDoc = ActiveDocument
Set ThatDoc = Documents("Yadda")
Set SourceTable = ThisDoc.Tables(3)
Set TargetTable = ThatDoc.Tables(2)
Now you can just transfer contents from one table to the other. You do not
have to make "Yadda" active; you do not have to copy and paste.
TargetTable.Cell(2, 2).Range.Text =
SourceTable.Cell(5,2).Range.Text
This makes Tables(2).Cell(2,2) in "Yadda" the contents of Tables(3).Cell(5,2)
in the active document.
This is a very simple example. You can also use cell objects and dump stuff
even mor eefficiently.
NOTE: you will need to strip off end-of-cell markers using the Range of the
cells, if you want a perfect copy.
>I am trying to move the contents of a table in one document into the
>cells of a larger table in a second document. The line
[quoted text clipped - 5 lines]
>
>Ed
Ed from AZ - 23 Jan 2008 13:44 GMT
Thanks for the reply. Thinking about it afterwards, I realized this
is probably the Excel VBA dialect, not Word! Oops!!
With your reply and a bit more thinking, it's working now.
Thanks again!
Ed
> First off, declaring a Range does indeed use a Start, and and End. However,
> Start:=tbl3.Cell(13, 1) is NOT a valid value for a Range value. Thus: Type
[quoted text clipped - 3 lines]
>
> tbl3.Cell(13, 1) is NOT a number, it is a cell.
> Second, I do not know what your other code is like, but I would guess that it
> could probably run better using objects. This is a simple example. An
[quoted text clipped - 39 lines]
> --
> Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/word-programming/200801/1