D
David Mann
I have had some funny results from a Word routine, which boils down to
having a range with cells.count=2, but only one cell. Can anyone explain
this?
1) Open Word and create a table with 2 rows and column.
Put 'a' in the top cell and 'b' in the bottom cell.
2) Open the immediate window and set a range to include both cells:
set rng=documents(1).Range(documents(1).Tables(1).Cell(1,1).Range.Start,
documents(1).Tables(1).Cell(2,1).Range.End)
3) Now examine the range:
?rng.cells.count returns 2
so it really does have two cells.
4) ?rng.cells(1).range returns 'a'
But, ?rng.cells(2).range does not return 'b',
in fact it fails, as does ?rng.cells(0).range.
"Run-time error '5941': The requested member of the collection does not
exist."
So how can I reference the second cell?
David
having a range with cells.count=2, but only one cell. Can anyone explain
this?
1) Open Word and create a table with 2 rows and column.
Put 'a' in the top cell and 'b' in the bottom cell.
2) Open the immediate window and set a range to include both cells:
set rng=documents(1).Range(documents(1).Tables(1).Cell(1,1).Range.Start,
documents(1).Tables(1).Cell(2,1).Range.End)
3) Now examine the range:
?rng.cells.count returns 2
so it really does have two cells.
4) ?rng.cells(1).range returns 'a'
But, ?rng.cells(2).range does not return 'b',
in fact it fails, as does ?rng.cells(0).range.
"Run-time error '5941': The requested member of the collection does not
exist."
So how can I reference the second cell?
David