Microsoft KB Archive/93036

{|
 * width="100%"|

WD: Selecting Table Columns and Rows Using WordBasic Macros

 * }

Q93036

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 1.0, 1.1, 1.1a, 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
 * Microsoft Word for Windows, versions 7.0, 7.0a
 * Microsoft Word for the Macintosh, versions 6.0, 6.0.1, 6.0.1a

-

SUMMARY
The WordBasic macro language provides the following commands for selecting columns or rows in Word for Windows tables.

Word 2.x, 6.x, 7.x
TableSelectColumn

Selects the column containing the insertion point in a table. The CharRight and CharLeft commands with the Select parameter specified (such as CharRight 1,1) can be used to extend the selection.

TableSelectRow

Selects the row containing the insertion point in a table. The LineDown command and LineUp commands with the Select parameter specified (such as LineDown 1,1) can be used to extend the selection.

NOTE: Before executing a WordBasic table command, you may need to determine if the insertion point is within a table. To do this, use SelInfo(12), which returns -1 if the insertion point is within a table. For example, the following TableSelectRow command will be executed only if the insertion point is within a table:

If SelInfo(12) Then TableSelectRow

Word 1.x
The WordBasic macro language in Word 1.x includes the StartofRow, EndOfRow, StartOfColumn, and EndOfColumn commands for selecting rows and columns in Word for Windows tables.

To select an entire table row in Word 1.x, use the following commands:

  Sub MAIN ' Selects Table Row StartOfRow EndOfRow 1 End Sub To select an entire table column in Word 1.x, use the following commands:

  Sub MAIN ' Selects Table Column StartOfColumn EndOfColumn 1 End Sub WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code &quot;as is&quot; without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.