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
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