Share via


Table.AutoFitBehavior Method

Word Developer Reference

Determines how Microsoft Office Word resizes a table when the AutoFit feature is used.

Syntax

expression.AutoFitBehavior(Behavior)

expression   Required. A variable that represents a Table object.

Parameters

Name Required/Optional Data Type Description
Behavior Required WdAutoFitBehavior How Word resizes the specified table with the AutoFit feature is used.

Remarks

Word can resize the table based on the content of the table cells or the width of the document window. You can also use this method to turn off AutoFit so that the table size is fixed, regardless of cell contents or window width.

Setting the AutoFitBehavior property to wdAutoFitContent or wdAutoFitWindow sets the AllowAutoFit property to True if it is currently False. Likewise, setting the AutoFitBehavior property to wdAutoFitFixed sets the AllowAutoFit property to False if it is currently True.

Example

This example sets the AutoFit behavior for the first table in the active document to automatically resize based on the width of the document window.

Visual Basic for Applications
  ActiveDocument.Tables(1).AutoFitBehavior _
    wdAutoFitWindow

See Also