C
COE
Hi Folks,
I am using Word 2000, which seems to have no easy method of
restarting/continuing lists without entering the Bullets & Numbering Box.
I am trying to create a toggle macro that will restart/continue numbering or
return an error if the text has no number. But as I have no programming
experience at all, I'm getting a bit lost!
From my travels through VBA Help, I've patched together something that will
restart numbering, but will not continue it and I can't quite work out how to
include the error message for no numbering.
Here's my (attempt at) code:
Sub testlistrestart()
'
' testlistrestart Macro
' Macro recorded 28/10/2005 by COE
' Toggle macro for button on toolbar to continue/restart list numbering
Dim CurrentLT
Dim temp
Set CurrentLT = Selection.Range.ListFormat
temp = CurrentLT.CanContinuePreviousList(ListTemplate:=CurrentLT.ListTemplate)
If temp <> wdContinueDisabled Then
CurrentLT.ApplyListTemplate ListTemplate:=CurrentLT.ListTemplate, _
ContinuePreviousList:=False
Exit Sub
If Not temp <> wdContinueList Then
CurrentLT.ApplyListTemplate ListTemplate:=CurrentLT.ListTemplate, _
ContinuePreviousList:=True
End If
Else
MsgBox "The current text has no numbering!"
End If
End Sub
Any help/pointers for someone just beggining to use VBA would be
appreciated. I tried to use a Not statement for the toggle because from the
examples I've seen it looks much tidier, but I don't know how I would use it
for this macro.
Cheers,
COE
I am using Word 2000, which seems to have no easy method of
restarting/continuing lists without entering the Bullets & Numbering Box.
I am trying to create a toggle macro that will restart/continue numbering or
return an error if the text has no number. But as I have no programming
experience at all, I'm getting a bit lost!
From my travels through VBA Help, I've patched together something that will
restart numbering, but will not continue it and I can't quite work out how to
include the error message for no numbering.
Here's my (attempt at) code:
Sub testlistrestart()
'
' testlistrestart Macro
' Macro recorded 28/10/2005 by COE
' Toggle macro for button on toolbar to continue/restart list numbering
Dim CurrentLT
Dim temp
Set CurrentLT = Selection.Range.ListFormat
temp = CurrentLT.CanContinuePreviousList(ListTemplate:=CurrentLT.ListTemplate)
If temp <> wdContinueDisabled Then
CurrentLT.ApplyListTemplate ListTemplate:=CurrentLT.ListTemplate, _
ContinuePreviousList:=False
Exit Sub
If Not temp <> wdContinueList Then
CurrentLT.ApplyListTemplate ListTemplate:=CurrentLT.ListTemplate, _
ContinuePreviousList:=True
End If
Else
MsgBox "The current text has no numbering!"
End If
End Sub
Any help/pointers for someone just beggining to use VBA would be
appreciated. I tried to use a Not statement for the toggle because from the
examples I've seen it looks much tidier, but I don't know how I would use it
for this macro.
Cheers,
COE