Steve,
Your code works fine for my first table. The first row has four cells, the
second row has a single cell and my 5 values each land in the correct cell.
But I have 6 consecutive tables with the same structure and when I try to
create the second table, I get:
Run-time error '4605': This method or property is not available because
the object refers to the end of a table row.
What do I need to change to be able to create and populate the 2nd through
6th tables? I thought I could possibly solve the problem by incrememnting
the index in the "With Selection.Tables(1)" line through the range 0 through
5 but that didn't work and neither did incrementing the index through the
range 1 through 6. I'm not sure what else to try.
---
Rhino
> Rhino,
>
[quoted text clipped - 55 lines]
>> make Draw Table possible again? Mind you, if I can't record the Draw
>> Table process, I don't care that much ;-)
Tony Jollans - 31 Jan 2006 10:05 GMT
To make sure you work with the table you've just created, set a reference to
it when you create it. You can use that reference instead of the explicit
reference to table #1.
Change:
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=2,
NumColumns:= _
4, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
With Selection.Tables(1)
Change:
Set NewTable = ActiveDocument.Tables.Add(Range:=Selection.Range,
NumRows:=2, NumColumns:= _
4, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed)
With NewTable
--
Enjoy,
Tony
> Steve,
>
[quoted text clipped - 78 lines]
> >> --
> >> Rhino
Steve Yandl - 31 Jan 2006 14:52 GMT
Rhino,
Tony's solution above gives you the most control as you're creating the
tables.
If you already have a set of tables created and want to process the entire
set, merging the cells in row 2 on each one, you could have something like
the following.
Sub MergeRowTwo()
Dim oTable As Table
For Each oTable In ActiveDocument.Tables
oTable.Rows(2).Cells.Merge
Next oTable
End Sub
Steve
> Steve,
>
[quoted text clipped - 76 lines]
>>> how to make Draw Table possible again? Mind you, if I can't record the
>>> Draw Table process, I don't care that much ;-)