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

ID: 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 95, 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 "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 : MACINTOSH:6.0,6.0.1; WINDOWS:2.0,2.0a,2.0a-CD,2.0b,2.0c,6.0,6.0a,6.0c,7.0,7.0a
Platform : MACINTOSH WINDOWS
Issue type : kbhowto


Last Reviewed: December 22, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.