WD: Selecting Table Columns and Rows Using WordBasic Macros

Last reviewed: February 2, 1998
Article ID: 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 95, versions 7.0, 7.0a
  • 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.

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 : kbmacroexample kbtable macword winword winword2 word6 word7 word95 kbmacro
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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.