Cells.NestingLevel property (Word)

Returns the nesting level of the specified cells. Read-only Long.

Syntax

expression. NestingLevel

expression A variable that represents a 'Cells' collection.

Remarks

The outermost table has a nesting level of 1. The nesting level of each successively nested table is one higher than the previous table.

Example

This example creates a new document, creates a nested table with three levels, and then fills the first cell of each table with its nesting level.

Documents.Add 
ActiveDocument.Tables.Add Selection.Range, _ 
 3, 3, wdWord9TableBehavior, wdAutoFitContent 
With ActiveDocument.Tables(1).Range 
 .Copy 
 .Cells(1).Range.Text = .Cells.NestingLevel 
 .Cells(5).Range.PasteAsNestedTable 
 With .Cells(5).Tables(1).Range 
 .Cells(1).Range.Text = .Cells.NestingLevel 
 .Cells(5).Range.PasteAsNestedTable 
 With .Cells(5).Tables(1).Range 
 .Cells(1).Range.Text = _ 
 .Cells.NestingLevel 
 End With 
 End With 
End With

See also

Cells Collection Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.