Microsoft KB Archive/83071

{|
 * width="100%"|

SelInfo(15) Returns Incorrect Number of Rows in WinWord Table
'Article ID: Q83071

Creation Date: 05-APR-1992

Revision Date: 09-SEP-1996' The information in this article applies to:


 * Microsoft Word for Windows versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0

SYMPTOMS

If you use the SelInfo WordBasic macro command to return the number of rows in a Microsoft Word for Windows table, the command always returns &quot;1&quot; if one of the following conditions exists:

 The insertion point is positioned at the start of the first cell in the table. -or- The table is not the first item in the document.

The SelInfo argument type 15 returns the number of rows in the table if the selection is within a table; if the selection is not in a table, the function returns &quot;-1.&quot; STATUS

Microsoft has confirmed this to be a problem in Word for Windows version 6.0. This problem was corrected in Word for Windows version 6.0a.

WORKAROUND

If the user selects the table first, before SelInfo is called, then Word will always display the correct number of rows. Example:

Sub Main n = SelInfo(15) If n = - 1 Then MsgBox &quot;Cursor is not in a table&quot; Else TableSelectTable MsgBox &quot;table rows&quot; + Str$(SelInfo(15)) EndIf End Sub Steps to Reproduce Problem

1. From the File menu, choose New, and choose the OK button. Press ENTER a few times to create some blank lines.

2. From the Table menu, choose Insert Table.

3. In the Number of Rows box, select 5.

4. Choose the OK button to create a 2-column, 5-row table.

5. From the Tools menu, choose Macro.

6. Type a name in the Macro Name box, and choose the Edit button.

7. On the blank line between the Sub MAIN and End Sub statements, type the following:

MsgBox &quot;Table Rows: &quot; + Str$(SelInfo(15))

8. From the Window menu, choose Arrange All.

9. Press CTRL+F6 to switch back to the document. The insertion point should be positioned in the first cell of the table.

Choose the Start button on the macro-testing bar.

Note: The message box incorrectly displays &quot;Table Rows: 1.&quot; The message box should display &quot;Table Rows: 5&quot; because there are 5 rows in the table.

Press the TAB key to move to the second column in the table.

Choose the Start button on the macro-testing bar. The message box correctly displays &quot;Table Rows: 5.&quot; Microsoft has confirmed this to be a problem in Microsoft Word for Windows versions 2.0, 2.0a, 2.0b, 2.0c and 6.0. We are researching this problem and will post new information here as it becomes available. REFERENCES

&quot;Using WordBasic,&quot; by WexTech Systems and Microsoft, pages 277-278
 * }

-

"THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED &quot;AS IS&quot; 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." '' ©1997 Microsoft Corporation. All rights reserved. Legal Notices.

''

KBCategory: kbusage kbmacro

KBSubcategory: kbtable

Additional reference words: 2.00 2.00a count cell 6.00 winword2 word6

winword w4wtable 2.00b 2.00a-CD