Table.AutoFitBehavior method (Word)

Determines how Microsoft 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.

ActiveDocument.Tables(1).AutoFitBehavior _ 
 wdAutoFitWindow

See also

Table 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.