Macro to Specify Starting Number for Numbered Lists

Last reviewed: February 5, 1998
Article ID: Q135076
The information in this article applies to:
  • Microsoft Word for Windows 95, version 7.0
  • Microsoft Word for Windows, version 6.0, 6.0a, 6.0c

SUMMARY

This article provides a macro that can be used to restart numbering for a selection. The macro displays a prompt in the status bar, asking you to specify a starting number. The macro requires at least one unnumbered paragraph above the selected paragraphs.

MORE INFORMATION

Word 7

'Function to trap ESC key
Declare Function GetAsyncKeyState Lib "USER32"(kState As Long) As Integer
Sub MAIN
DisableInput                                   'Disable ESC canceling macro
                                               'and posting errmsg.
Dim dlg As FormatNumber : GetCurValues dlg     'Variable to hold new
                                               'sequence number.
a$ = dlg.StartAt                               'Prompt on status bar.
Line Input "Start numbering at:  ", a$         'If ESC is not pressed.
If GetAsyncKeyState(27) = 0 Then
FormatNumber .StartAt = Str$(Int(Val(a$)))     'This construction will trap
                                               'for non-integer values.
                                               'Number selected paragraphs
                                               'beginning with number
                                               'entered on status bar.
EndIf : End Sub

Word 6

'Function to trap ESC key
Declare Function GetAsynchKeyState Lib "USER"(KState As Integer) As Integer
Sub MAIN
DisableInput                                   'Disable ESC canceling macro
                                               'and posting errmsg.
Dim dlg As FormatNumber : GetCurValues dlg     'Variable to hold new
                                               'sequence number.
a$ = dlg.StartAt                               'Prompt on status bar.
Line Input "Start numbering at:  ", a$         'If ESC is not pressed.
If GetAsyncKeyState(27) = 0 Then
FormatNumber .StartAt = Str$(Int(Val(a$)))     'This construction will trap
                                               'for non-integer values.
                                               'Number selected paragraphs
                                               'beginning with number
                                               'entered on status bar.
EndIf : End Sub

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.


KBCategory: kbusage kbmacro
KBSubcategory: kbmacroexample

Additional reference words: 7.0 word95 format number numbers numbering
word7 winword word6

Keywords : kbmacroexample
Version : 6.0 6.0a 6.0c 7.0
Platform : WINDOWS


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