WD: WordBasic Macro for Numbering Rows of a TableLast reviewed: February 2, 1998Article ID: Q89536 |
The information in this article applies to:
SUMMARYThe following Microsoft WordBasic sample macro numbers each of the rows in a table. The macro inserts an AutoNum field at the beginning of the first cell in each table row.
Sub Main
If SelInfo(12) <> - 1 Then
MsgBox "The insertion point is not in a table cell"
Else
currow = SelInfo(13)
TableSelectTable
StartOfRow
While SelInfo(12) = - 1
StartOfLine
InsertField .Field = "autonum"
' Move down to next row (row may have more than one line)
oldrow = currow
While currow = oldrow
LineDown 1
currow = SelInfo(13)
Wend
Wend
End If
End Sub
In order to insert a tab after the number, add the following macro
instruction after the InsertField statement in the above macro example:
Insert Chr$(9)NOTE: Microsoft provides macros "as is" without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purposes.
REFERENCES"Using WordBasic," WexTech Systems and Microsoft, pages 50, 239, 251, 257, 277-278, 291, 333 "Microsoft Word for Windows and OS/2 Technical Reference", pages 68- 69, 103-106, 203, 213, 223, 263, 286
|
Additional query words: automatic automatically records data
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |