Discussion:
Continue numbering with a macro?
(too old to reply)
COE
2005-11-08 00:22:02 UTC
Permalink
Hi All,

First a warning- I'm a programming newbie & have only been looking at macros
seriously for a few weeks.

I'm trying to create a button that not only restarts style based numbering,
but will also function as a toggle - ie continue numbering if it has been
restarted, because, gosh darn it, it would be so much handier. I'm using Word
2000, so I need some sort of easily accessible restart button, but I can't
help but try to go the extra mile & get it to work both ways.

The problem is - How do I get rid of the restart marker if the numbering has
been restarted?

I've patched together some code using the ideas at
http://word.mvps.org/FAQs/Numbering/ListRestartFromVBA.htm. Here it is -
feel free to be picky. I really have no idea what I'm doing :-)

So far it restarts numbering fine- and it doesn't produce any errors (woo
hoo) - but it doesn't continue numbering. I have a feeling that somethine
entirely different and more complicated is required to do that. Does anyone
have any ideas?

Sub LTtest()
' LTtest Macro
' Macro recorded 7/11/2005 by COE
' Using ideas from a macro created by John McGhie from an idea by Steve
Hudson and examples in Help files.

Set myLF = Selection.Range.ListFormat
temp = myLF.CanContinuePreviousList(ListTemplate:=myLF.ListTemplate)

With Selection.Range
If temp <> wdContinueDisabled Then
With Selection.Range.ListFormat
.ApplyListTemplate .ListTemplate, False
End With
ElseIf temp = wdContinueDisabled Then
With Selection.Range.ListFormat
.ApplyListTemplate myLF, True
End With
End If
End With

End Sub
Jean-Guy Marcil
2005-11-08 02:27:36 UTC
Permalink
Post by COE
Hi All,
First a warning- I'm a programming newbie & have only been looking at
macros seriously for a few weeks.
I'm trying to create a button that not only restarts style based
numbering, but will also function as a toggle - ie continue numbering
if it has been restarted, because, gosh darn it, it would be so much
handier. I'm using Word 2000, so I need some sort of easily
accessible restart button, but I can't help but try to go the extra
mile & get it to work both ways.
You could switch to Word XP or higher where right clicking on a numbered
list offers "Continue" or "Restart" numbering....

Getting it to work both ways is a real can of worms, especially if you are
not working with named list templates.... Even then....

The easiest, by far, is to use Word built-in commands:
Tools > Customize... > Commands tab > select All Commands and then in
the list on the right-hand side, drag to the toolbar of your choice the
"Continue Numbering" and "Restart Numbering" commands.
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
***@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
COE
2005-11-08 05:11:05 UTC
Permalink
Hi Jean-Guy,

Thanks. I knew I was getting myself in a pickle.

Yes, upgrading to Office XP is definitely on the board, especially for a
firm that promotes itself as 'progressive', but I've only been here a few
months, so it might take a little while to turn the ship around :-) That,
and fixing our styles so they have named list templates!!

Unfortunately, I do not have the "Continue Numbering" and "Restart
Numbering" commands listed in All Commands. They must not have put them in
2000? How inconsiderate :-)

Cheers,
COE
Post by Jean-Guy Marcil
Post by COE
Hi All,
First a warning- I'm a programming newbie & have only been looking at
macros seriously for a few weeks.
I'm trying to create a button that not only restarts style based
numbering, but will also function as a toggle - ie continue numbering
if it has been restarted, because, gosh darn it, it would be so much
handier. I'm using Word 2000, so I need some sort of easily
accessible restart button, but I can't help but try to go the extra
mile & get it to work both ways.
You could switch to Word XP or higher where right clicking on a numbered
list offers "Continue" or "Restart" numbering....
Getting it to work both ways is a real can of worms, especially if you are
not working with named list templates.... Even then....
Tools > Customize... > Commands tab > select All Commands and then in
the list on the right-hand side, drag to the toolbar of your choice the
"Continue Numbering" and "Restart Numbering" commands.
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
Word MVP site: http://www.word.mvps.org
Continue reading on narkive:
Loading...