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

Re: Create a toggle button for restart/continue list by Stefan

Stefan
Fri Oct 28 05:14:16 CDT 2005

See http://word.mvps.org/FAQs/Numbering/ListRestartFromVBA.htm

--
Stefan Blom
Microsoft Word MVP


"COE" wrote in message
news:9EB07C0C-FDEF-4E2B-831A-2A3A2829D384@microsoft.com...
> 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




Re: Create a toggle button for restart/continue list by COE

COE
Sun Oct 30 18:06:02 CST 2005

ooo bum, I forgot about that article.

Well, maybe trying it myself was 'character building' :-)

Thanks Stefan.

"Stefan Blom" wrote:

> See http://word.mvps.org/FAQs/Numbering/ListRestartFromVBA.htm
>
> --
> Stefan Blom
> Microsoft Word MVP
>
>
> "COE" wrote in message
> news:9EB07C0C-FDEF-4E2B-831A-2A3A2829D384@microsoft.com...
> > 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
>
>
>
>

Re: Create a toggle button for restart/continue list by Stefan

Stefan
Mon Oct 31 02:43:28 CST 2005

I'm glad I could point you in the right direction.

I'm not sure if macro programming can be character building, but it
wouldn't surprise me. <g>

--
Stefan Blom
Microsoft Word MVP


"COE" wrote in message
news:020B7EC2-2C37-427E-A3E4-F1F8DC936052@microsoft.com...
> ooo bum, I forgot about that article.
>
> Well, maybe trying it myself was 'character building' :-)
>
> Thanks Stefan.
>
> "Stefan Blom" wrote:
>
> > See http://word.mvps.org/FAQs/Numbering/ListRestartFromVBA.htm
> >
> > --
> > Stefan Blom
> > Microsoft Word MVP
> >
> >
> > "COE" wrote in message
> > news:9EB07C0C-FDEF-4E2B-831A-2A3A2829D384@microsoft.com...
> > > 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
> >
> >
> >
> >







Re: Create a toggle button for restart/continue list by COE

COE
Fri Nov 04 00:16:02 CST 2005

Hmmm, I have just one problem with this macro.

As soon as I put in the arglist (Optional Scope As Range), then the macro
disappears from my list of macros.
Yet if I remove it, then of course I get an error.

What could be going on there?

CHeers,
COE

"Stefan Blom" wrote:

> I'm glad I could point you in the right direction.
>
> I'm not sure if macro programming can be character building, but it
> wouldn't surprise me. <g>
>
> --
> Stefan Blom
> Microsoft Word MVP
>
>
> "COE" wrote in message
> news:020B7EC2-2C37-427E-A3E4-F1F8DC936052@microsoft.com...
> > ooo bum, I forgot about that article.
> >
> > Well, maybe trying it myself was 'character building' :-)
> >
> > Thanks Stefan.
> >
> > "Stefan Blom" wrote:
> >
> > > See http://word.mvps.org/FAQs/Numbering/ListRestartFromVBA.htm
> > >
> > > --
> > > Stefan Blom
> > > Microsoft Word MVP
> > >
> > >
> > > "COE" wrote in message
> > > news:9EB07C0C-FDEF-4E2B-831A-2A3A2829D384@microsoft.com...
> > > > 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
> > >
> > >
> > >
> > >
>
>
>
>
>
>
>

Re: Create a toggle button for restart/continue list by Stefan

Stefan
Mon Nov 07 03:54:53 CST 2005

The problem you're having is caused by the fact that you cannot run a
sub or function which requires parameters from the Macros dialog box;
instead, it must be called from a sub-routine.

However, to get specific help with the code at
http://word.mvps.org/FAQs/Numbering/ListRestartFromVBA.htm, you need
someone who is an expert of VBA. Ask for help in a separate message.

--
Stefan Blom
Microsoft Word MVP


"COE" wrote in message
news:EC61C367-16F5-44E2-AE29-CE2462452864@microsoft.com...
> Hmmm, I have just one problem with this macro.
>
> As soon as I put in the arglist (Optional Scope As Range), then the
macro
> disappears from my list of macros.
> Yet if I remove it, then of course I get an error.
>
> What could be going on there?
>
> CHeers,
> COE
>
> "Stefan Blom" wrote:
>
> > I'm glad I could point you in the right direction.
> >
> > I'm not sure if macro programming can be character building, but
it
> > wouldn't surprise me. <g>
> >
> > --
> > Stefan Blom
> > Microsoft Word MVP
> >
> >
> > "COE" wrote in message
> > news:020B7EC2-2C37-427E-A3E4-F1F8DC936052@microsoft.com...
> > > ooo bum, I forgot about that article.
> > >
> > > Well, maybe trying it myself was 'character building' :-)
> > >
> > > Thanks Stefan.
> > >
> > > "Stefan Blom" wrote:
> > >
> > > > See http://word.mvps.org/FAQs/Numbering/ListRestartFromVBA.htm
> > > >
> > > > --
> > > > Stefan Blom
> > > > Microsoft Word MVP
> > > >
> > > >
> > > > "COE" wrote in message
> > > > news:9EB07C0C-FDEF-4E2B-831A-2A3A2829D384@microsoft.com...
> > > > > 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
> > > >
> > > >
> > > >
> > > >
> >
> >
> >
> >
> >
> >
> >







Re: Create a toggle button for restart/continue list by COE

COE
Mon Nov 07 18:10:02 CST 2005

Thanks Stefan.
I've patched together some code that does half of what I want (ie it
restarts my Style based numbering).
Now for the hard bit - getting it to work as a toggle button!
I'll send a seperate message if (when!) I need help.

Thank you very much.

"Stefan Blom" wrote:

> The problem you're having is caused by the fact that you cannot run a
> sub or function which requires parameters from the Macros dialog box;
> instead, it must be called from a sub-routine.
>
> However, to get specific help with the code at
> http://word.mvps.org/FAQs/Numbering/ListRestartFromVBA.htm, you need
> someone who is an expert of VBA. Ask for help in a separate message.
>
> --
> Stefan Blom
> Microsoft Word MVP
>
>
> "COE" wrote in message
> news:EC61C367-16F5-44E2-AE29-CE2462452864@microsoft.com...
> > Hmmm, I have just one problem with this macro.
> >
> > As soon as I put in the arglist (Optional Scope As Range), then the
> macro
> > disappears from my list of macros.
> > Yet if I remove it, then of course I get an error.
> >
> > What could be going on there?
> >
> > CHeers,
> > COE
> >
> > "Stefan Blom" wrote:
> >
> > > I'm glad I could point you in the right direction.
> > >
> > > I'm not sure if macro programming can be character building, but
> it
> > > wouldn't surprise me. <g>
> > >
> > > --
> > > Stefan Blom
> > > Microsoft Word MVP
> > >
> > >
> > > "COE" wrote in message
> > > news:020B7EC2-2C37-427E-A3E4-F1F8DC936052@microsoft.com...
> > > > ooo bum, I forgot about that article.
> > > >
> > > > Well, maybe trying it myself was 'character building' :-)
> > > >
> > > > Thanks Stefan.
> > > >
> > > > "Stefan Blom" wrote:
> > > >
> > > > > See http://word.mvps.org/FAQs/Numbering/ListRestartFromVBA.htm
> > > > >
> > > > > --
> > > > > Stefan Blom
> > > > > Microsoft Word MVP
> > > > >
> > > > >
> > > > > "COE" wrote in message
> > > > > news:9EB07C0C-FDEF-4E2B-831A-2A3A2829D384@microsoft.com...
> > > > > > 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
> > > > >
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
>
>
>
>
>
>
>