Thanks, Jezebel. I think you've transposed the table number and column
number. Would the correct code not be:
If Selection.Information(wdWithInTable) then
If Selection.Tables(4).range.start =
activedocument.tables(4).range.start and _
Selection.Cells(1).ColumnIndex = 1 then ...
David
Not quite. If the selection is within a table, then Selection.Tables(1) is a
reference to that table. Selection.Tables(4) would refer to the fourth table
within the selection. You're making two tests --
1. Is the selection within the fourth table in the document --
Selection.Tables(1).range.start = ActiveDocument.Tables(4).Range.Start
2. Is the selection within a given column --
Selection.Cells(1).ColumnIndex = x
Note that this could all get tricky if you have nested tables (ie one table
within another), or if the selection included several tables.
> Thanks, Jezebel. I think you've transposed the table number and column
> number. Would the correct code not be:
[quoted text clipped - 22 lines]
>> > TIA
>> > David
Compass Rose - 27 Oct 2006 22:17 GMT
Thanks for the explanation.
No, fortunately I don't have nested tables. I try to keep things simple.
David
> Not quite. If the selection is within a table, then Selection.Tables(1) is a
> reference to that table. Selection.Tables(4) would refer to the fourth table
[quoted text clipped - 37 lines]
> >> > TIA
> >> > David