ID: Q88540
The information in this article applies to:
You can use the EditGoto statement in Word to move to the next table in your document. The "t" identifier is used to specify a table. The following statement moves the insertion point to the first cell in the next table.
EditGoTo "t+" 'moves to the next table
You can use the EditFind command to search for a number of special
characters. However, this command cannot be used to locate a table in
a Word for Windows document. To search for tables in a document, use
the following macro:
Sub MAIN
StartOfDocument
While CmpBookmarks("\sel", "\endofdoc") 'While loop
n = SelInfo(12) 'Returns -1 if in table
If n = - 1 Then 'If -1 is returned post message
choice = MsgBox("Table found, find next table?", 4)
If choice = 0 Then Goto bye
If choice = - 1 Then 'If OK pressed, find next.
TableSelectTable
CharRight 1
EndIf
Else
LineDown 'If no table found, line down 1
End If
Wend
bye:
End Sub
The above macro uses a While Wend loop to search through the document for tables. The macro uses the SelInfo command to determine if the cursor is in a Word for Windows table. SelInfo(12) will return a -1 if the selection is in a Word table, and Word displays a message box with the text "Table Found." If the selection does not contain a table, the macro will move the cursor to the next line in the document.
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.
"Using WordBasic," by WexTech Systems and Microsoft, pages 277-278, 333
Kbcategory: kbusage kbmacro KBSubcategory: kbtable Additional query words: winword2 word6 7.0 word95 word7 6.0.1 macword winword 2.0 2.0a
Keywords : kbmacro winword ntword macword kbtable word6 winword2 word7
Version : WINDOWS:2.0,2.0a,2.0a-CD,2.0b,2.0c,6.0,6.0a,6.0c,7.0,7.0a; MACINTOSH:6.0,6.0.1,6.0.6.0.1a
Last Reviewed: February 4, 1998