Selection.ConvertToTable procedure builder

Selection.ConvertToTable (Word)

Converts text within a range to a table. Returns the table as a Table object.

ConvertToTable (Separator, NumRows, NumColumns, InitialColumnWidth, Format, ApplyBorders, ApplyShading, ApplyFont, ApplyColor, ApplyHeadingRows, ApplyLastRow, ApplyFirstColumn, ApplyLastColumn, AutoFit, AutoFitBehavior, DefaultTableBehavior)

With Selection 
 .Collapse 
 .InsertBefore "one, two, three" 
 .InsertParagraphAfter 
 .InsertAfter "one, two, three" 
 .InsertParagraphAfter 
End With 
Set myTable = Selection.ConvertToTable( _ 
 Separator:=wdSeparateByCommas, _ 
 Format:=wdTableFormatList8)

Arguments

Optional arguments

The following arguments are optional

Separator - Specifies the character used to separate text into cells. Can be a character or one of the following WdTableFieldSeparator constant. If this argument is omitted, the value of the DefaultTableSeparator property is used

NumRows - The number of rows in the table. If this argument is omitted, Microsoft Word sets the number of rows, based on the contents of the range

NumColumns - The number of columns in the table. If this argument is omitted, Word sets the number of columns, based on the contents of the range

InitialColumnWidth - The initial width of each column, in points. If this argument is omitted, Word calculates and adjusts the column width so that the table stretches from margin to margin

Format - Specifies one of the predefined formats listed in the Table AutoFormat dialog box. Can be one of the WdTableFormat constants

ApplyBorders - True to apply the border properties of the specified format

ApplyShading - True to apply the shading properties of the specified format

ApplyFont - True to apply the font properties of the specified format

ApplyColor - True to apply the color properties of the specified format

ApplyHeadingRows - True to apply the heading-row properties of the specified format

ApplyLastRow - True to apply the last-row properties of the specified format

ApplyFirstColumn - True to apply the first-column properties of the specified format

ApplyLastColumn - True to apply the last-column properties of the specified format

AutoFit - True to decrease the width of the table columns as much as possible without changing the way text wraps in the cells

AutoFitBehavior (WdDefaultTableBehavior) - Sets the AutoFit rules for how Word sizes a table. Can be one of the following WdAutoFitBehavior constant. If DefaultTableBehavior is wdWord8TableBehavior, this argument is ignored.

Possible Values are wdWord8TableBehavior - Disables AutoFit. Default, wdWord9TableBehavior - Enables AutoFit.

DefaultTableBehavior - Sets a value that specifies whether Microsoft Word automatically resizes cells in a table to fit the contents (AutoFit). Can be one of the WdDefaultTableBehavior constant