RestartListNumbering now XP compat

W

Word Heretic

(Reposted from Word PC mailing list)

Those of you who have been hanging around this list sucking down words
of wisdom from all and sundry will remember my list restart
breakthrough - the first macro to attach to a toolbar / shortcut to
restart your list numbering, irrespective of the list type. Of course,
this failed to work with XP's List Styles. Ordinary styles with list
properties - sure - but List Styles proper - nope.

Well, I had a brainstorm the other night. I think it was a brainstorm,
my head was buzzing with pain and water was leaking out if it
everywhere, maybe it was just the 'flu. Regardless, I have just tested
the concept and it WORKS muck ya.

I got lucky - Word XP actually bothers to include the New Object list
styles into the Old Object ListParagraphs. This is enough information
for the few wise asses to mangle the old code to come up with a
solution. However, I also bothered to demangle the old code to not use
an on error trap.

Everyone has permission to redistribute and use this code at will,
providing the (c) notice is left intact. In the interests of reducing
Worders Compensation cases, please DO post to any lists, friends and
so on that you have access to. Let's see if we cant make this one of
the fastest spams in town.


Public Sub RestartListNumbering(Optional Scope As Range)
'(c) 1999-2004 Word Heretic (e-mail address removed)
'Restarts list numbering, 97-XP, all list implementations

Dim KillScope As Boolean

If Scope Is Nothing Then
Set Scope = Selection.Range
KillScope = True
End If

'Use first listpara

With Scope.ListParagraphs
If .Count > 0 Then
With .Item(1).Range.ListFormat
.ApplyListTemplate .ListTemplate, False
End With
End If
End With

'Destroy our objects

If KillScope Then Set Scope = Nothing
End Sub
 
T

Tonya Marshall

Tried it in WD2003 and am not having any luck. How do you put it on a
toolbar? It doesn't show in Macros in the Command list in Customize.
Probably I've done something wrong. I used the first list numbering
style and then typed a paragraph (not numbered), restarted list
numbering and it continued the the numbering.
Hope you get over your flu.
 
W

Word Heretic

G'day Tonya Marshall <[email protected]>,

If it doesnt show in the customize (it does for 2k) - remove the
Optional parameter, add it to the toolbar, then re-add in the Optional
parameter again.


Steve Hudson - Word Heretic Sydney Australia
Word eTutor

steve from wordheretic.com (Email replies require payment)


Tonya Marshall reckoned:
 
T

Tonya Marshall

WTG!!! Excellent and thanks! I'm carrying on the spam tradition and
sending this to myself at my workplace. It's nice to get a handle on the
numbering that doesn't make me tear my hear out at every turn.
 

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