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

Last reviewed: February 16, 1998
Article 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
  • 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 : kbmacroexample kbtable macword winword word6 word7 word95 wordnt 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


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 16, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.