PreferredWidth Property

Microsoft Word Visual Basic

Show All

PreferredWidth Property

       

PreferredWidth property as it applies to the Cell, Cells, Column, Columns, and Table objects.

Returns or sets the preferred width (in points or as a percentage of the window width) for the specified cell, cells, columns, or table. Read/write Single.

expression.PreferredWidth

expression   Required. An expression that returns one of the above objects.

 

PreferredWidth property as it applies to the TableStyle object.

Returns or sets the preferred width (in points or as a percentage of the window width) for the specified table style. Read-only Single.

expression.PreferredWidth

expression   Required. An expression that returns one of the above objects.

 

Remarks

If the PreferredWidthType property is set to wdPreferredWidthPoints, the PreferredWidth property returns or sets the width in points. If the PreferredWidthType property is set to wdPreferredWidthPercent, the PreferredWidth property returns or sets the width as a percentage of the window width.

Example

This example sets Microsoft Word to accept preferred widths as a percentage of window width, and then sets the preferred width of the first table in the document to 50% of the window width.

With ActiveDocument.Tables(1)
    .PreferredWidthType = wdPreferredWidthPercent
    .PreferredWidth = 50
End With