Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Tables Collection Object

Office 2007
A collection of Table objects that represent the tables in a selection, range, or document.

Remarks

Use the Tables property to return the Tables collection. The following example applies a border around each of the tables in the active document.

Visual Basic for Applications
For Each aTable In ActiveDocument.Tables
    aTable.Borders.OutsideLineStyle = wdLineStyleSingle
    aTable.Borders.OutsideLineWidth = wdLineWidth025pt
    aTable.Borders.InsideLineStyle = wdLineStyleNone
Next aTable

Use the Add method to add a table at the specified range. The following example adds a 3x4 table at the beginning of the active document.

Visual Basic for Applications
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.Tables.Add Range:=myRange, NumRows:=3, NumColumns:=4

Use Tables(Index), where Index is the index number, to return a single Table object. The index number represents the position of the table in the selection, range, or document. The following example converts the first table in the active document to text.

Visual Basic for Applications
ActiveDocument.Tables(1).ConvertToText Separator:=wdSeparateByTabs

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object.




Community Additions

Show:
© 2014 Microsoft