Restarting list numbering using VBA

N

Nancy

I am using Word 2000 to create various templates for different purposes.

I have had good success with the first VB macro described in Margaret Adlis'
article, Restarting list numbering using VBA (Public Sub
RestartListNumbering(Optional Scope As Range)), and am trying to achieve that
success in all my templates.

The problem I am encountering is that I can only assign a shortcut key for
this macro in half my templates. In all my templates I can see the code when
I step into another one, but only some of the templates show
"RestartListNumbering" in my list of macros (Tools>Macro>Macros). It is also
not visible when I try to assign a key to it (View> Toolbars > Customize >
Keyboard, etc.) I have no problems with the other 4 basic macros I've
created.

I know very little about VB, but when I delete "Optional Scope As Range" in
the first line, the macro name then appears in the list of macros, but of
course it cannot be used until debugged and as soon as I insert that phrase
again, it disappears.

I have tried creating a new template based on one that has this macro
working, but again, it doesn't appear on the list.

Your help to restore my sanity is appreciated. thanks.
 
K

Klaus Linke

Hi Nancy,

You can't run macros with parameters directly, since you can't supply the parameter.

Don't understand why the optional parameter is needed? And why you would want to apply the same restart to more than one paragraph? It only makes sense to apply a restart to one paragraph, and usually that's the paragraph you're in.


Guess you can remove all that stuff with scope and killscope, and use
With Selection.Paragraphs(1).Range.ListParagraphs
instead of
With Scope.ListParagraphs
You can put the macro in a global template (or Normal.dot) to have it always available.

Regards,
Klaus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top