WD: Selecting Table Columns and Rows Using WordBasic Macros

ID: Q93036

The information in this article applies to:

SUMMARY

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

MORE INFORMATION

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 "as is" 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.

REFERENCES

"Microsoft Word for Windows Technical Reference," page 165-166

"Using WordBasic," by WexTech Systems and Microsoft, pages 300-301

Additional query words: TableSelectRow TableSelectColumn

Keywords          : kbmacro kbmacroexample winword macword kbtable word6 winword2 word7 word95 
Version           : WINDOWS:1.0,1.1,1.1a,2.0,2.0a,2.0a- CD,2.0b,2.0c,6.0,6.0a,6.0c,7.0,7.0a; MACINTOSH:6.0,6.0.1,6.0.1a
Platform          : MACINTOSH Win95 WINDOWS winnt
Issue type        : kbinfo

Last Reviewed: February 4, 1998