Microsoft KB Archive/83730

{|
 * width="100%"|

WD: Macro to Determine If Insertion Point Is in a Table

 * }

Q83730

-

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, 6.0a, 6.0c
 * Microsoft Word for Windows, versions 7.0, 7.0a
 * Microsoft Word for the Macintosh, versions 6.0, 6.0.1

-

SUMMARY
When you write a macro in WordBasic, you may need to know whether the insertion point is positioned within a Word for Windows table.

The sample macros in the &quot;More Information&quot; section of this article display a message box stating whether the insertion point is within a Word for Windows table.

MORE INFORMATION
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.

This example uses the SelInfo command to determine if the insertion point is within a table. This command is not available in Word for Windows version 1.x.

Sub MAIN n = SelInfo(12) If n = -1 Then MsgBox &quot;Cursor is in a table&quot; Else MsgBox &quot;Cursor is not in a table&quot; End If End Sub

SYNTAX
n = SelInfo(Type) The SelInfo command returns various types of information about the current selection. There are 30 different arguments (types) for the SelInfo command. Type number 12 returns -1 if the selection is within a table.