Range.Tables Property (Word)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns a Tables collection that represents all the tables in the specified range. Read-only.

expression .Tables

expression A variable that represents a Range object.

For information about returning a single member of a collection, see Returning an Object from a Collection.

This example creates a 5x5 table in the active document and then applies a predefined format to it.

Selection.Collapse Direction:=wdCollapseStart 
Set myTable = ActiveDocument.Tables.Add(Range:=Selection.Range, _ 
NumRows:=5, NumColumns:=5) 
myTable.AutoFormat Format:=wdTableFormatClassic2

This example inserts numbers and text into the first column of the first table in the active document.

num = 90 
For Each acell In ActiveDocument.Tables(1).Columns(1).Cells 
 acell.Range.Text = num & " Sales" 
 num = num + 1 
Next acell


Other resources