Continue numbering with a macro?

C

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.

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
 
J

Jean-Guy Marcil

COE was telling us:
COE nous racontait que :
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
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
C

COE

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
 

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