Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Toggle numbered lists to restart/continue (Word 2000)

    Hi

    I've searched through all the stuff on programmatically restarting or continuing a numbered list (not outline numbering), but can't find one that toggles between "restart" and "continue". So, I said, I'll do it myself. Then I couldn't work out how to determine what the current setting is. Oh.

    No doubt it's in WOPR somewhere. Can someone please point me at it.

    Thanks for your help
    Dale

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Toggle numbered lists to restart/continue (Word 2000)

    Look up ApplyListTemplate and CanContinuePreviousList in the online help for Word VBA, or do a rearch for one of these terms in the Word and/or VBA forum.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Toggle numbered lists to restart/continue (Word 2000)

    I've already tried that, Hans, but can't find code to toggle between the two settings. I must be missing something. (A brain?)

    Dale

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Toggle numbered lists to restart/continue (Word 2000)

    This code sometimes works, but it is not dependable. Perhaps one of the Word (VBA) gurus will post an improvement.

    Sub ToggleListReset()
    Dim lfTemp As ListFormat
    Dim intContinue As Integer

    Set lfTemp = Selection.Range.ListFormat
    If Not (lfTemp.ListTemplate Is Nothing) Then
    intContinue = lfTemp.CanContinuePreviousList( _
    ListTemplate:=lfTemp.ListTemplate)
    If intContinue = wdContinueList Then
    lfTemp.ApplyListTemplate _
    ListTemplate:=lfTemp.ListTemplate, _
    ContinuePreviousList:=False, _
    ApplyTo:=wdListApplyToWholeList
    Else
    lfTemp.ApplyListTemplate _
    ListTemplate:=lfTemp.ListTemplate, _
    ContinuePreviousList:=True, _
    ApplyTo:=wdListApplyToWholeList
    End If
    End If

    Set lfTemp = Nothing
    End Sub

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Toggle numbered lists to restart/continue (Word 2000)

    Hi Hans

    It didn't work for me. The value of "wdContinueList" never changed, so the same option was applied each time (ContinuePreviousList:=False).

    I modified the code to apply "ContinuePreviousList:=False", regardless, and see what happens. If the numbering doesn't change, then I apply "ContinuePreviousList:=True", as follows:
    <pre>Sub ToggleListReset()
    Dim lfTemp As ListFormat
    Dim intContinue As Integer
    Dim oldListNumber As Single

    Set lfTemp = Selection.Range.ListFormat
    oldListNumber = lfTemp.ListValue
    If Not (lfTemp.ListTemplate Is Nothing) Then
    intContinue = lfTemp.CanContinuePreviousList( _
    ListTemplate:=lfTemp.ListTemplate)
    lfTemp.ApplyListTemplate _
    ListTemplate:=lfTemp.ListTemplate, _
    ContinuePreviousList:=False, _
    ApplyTo:=wdListApplyToWholeList
    If lfTemp.ListValue = oldListNumber Then
    'The previous command didn't change anything
    'So do this
    lfTemp.ApplyListTemplate _
    ListTemplate:=lfTemp.ListTemplate, _
    ContinuePreviousList:=True, _
    ApplyTo:=wdListApplyToWholeList
    End If
    End If

    Set lfTemp = Nothing
    End Sub
    </pre>


    Works for me.
    Thanks for your help, Hans
    Dale

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Toggle numbered lists to restart/continue (Word 2000)

    Good for you. I couldn't get the code to work consistently, I am glad you were able to adapt it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •