Share via

Tables.Add Method 

Returns a Table object that represents a new, blank table added to a document.

Namespace: Microsoft.Office.Interop.Word
Assembly: Microsoft.Office.Interop.Word (in


Dim Range As Range
Dim NumRows As Integer
Dim NumColumns As Integer
Dim DefaultTableBehavior As Object
Dim AutoFitBehavior As Object
Dim returnValue As Table
Dim tables1 As Tables
returnValue = tables1.Add(Range, NumRows, NumColumns, DefaultTableBehavior, AutoFitBehavior)


Function Add( _
    <InAttribute()> ByVal Range As Range, _
    <InAttribute()> ByVal NumRows As Integer, _
    <InAttribute()> ByVal NumColumns As Integer, _
    <InAttribute()> Optional ByRef DefaultTableBehavior As Object, _
    <InAttribute()> Optional ByRef AutoFitBehavior As Object _
) As Table
Table Add(
    [In] Range Range, 
    [In] int NumRows, 
    [In] int NumColumns, 
    [In, Optional] ref object DefaultTableBehavior, 
    [In, Optional] ref object AutoFitBehavior
public: Table^ Add(
    Range^ Range, 
    Int32 NumRows, 
    Int32 NumColumns, 
    &Object^ DefaultTableBehavior, 
    &Object^ AutoFitBehavior
public Table Add(
    /*in*/Range Range, 
    /*in*/int NumRows, 
    /*in*/int NumColumns, 
    /*in*/System.Object DefaultTableBehavior, 
    /*in*/System.Object AutoFitBehavior
function Add(
     Range : Range, 
     NumRows : int, 
     NumColumns : int, 
     DefaultTableBehavior : Object, 
     AutoFitBehavior : Object
) : Table;


  • Range
    Required Range object. The range where you want the table to appear. The table replaces the range, if the range isn't collapsed.
  • NumRows
    Required Integer. The number of rows you want to include in the table.
  • NumColumns
    Required Integer. The number of columns you want to include in the table.
  • DefaultTableBehavior
    Optional Object. Sets a value that specifies whether Word automatically resizes cells in tables to fit the cells’ contents (AutoFit). Can be either of the following constants: wdWord8TableBehavior (AutoFit disabled) or wdWord9TableBehavior (AutoFit enabled). The default constant is wdWord8TableBehavior.
  • AutoFitBehavior
    Optional Object. Sets the AutoFit rules for how Microsoft Word sizes tables. Can be one of the following WdAutoFitBehavior constants: wdAutoFitContent, wdAutoFitFixed, or wdAutoFitWindow. If DefaultTableBehavior is set to wdWord8TableBehavior, this argument is ignored.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000

Target Platforms

See Also


Tables Interface
Microsoft.Office.Interop.Word Namespace

Other Resources

Tables Members