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

ID: Q83730

The information in this article applies to:

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 "More Information" 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 "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.

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 "Cursor is in a table"
      Else
         MsgBox "Cursor is not in a table"
      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.

REFERENCES

"Using WordBasic," by WexTech Systems and Microsoft, page 277-278

Additional query words:

Keywords          : wordnt kbmacroexample winword macword kbtable word6 word7 word95 macword6 
Version           : WINDOWS:2.x,6.0,6.0a,6.0c,7.0,7.0a; MACINTOSH:6.0,6.0.1,7.0,7.0a
Platform          : MACINTOSH Win95 WINDOWS
Issue type        : kbhowto

Last Reviewed: April 23, 1998