Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Apr 2003
    Location
    Kansas City, Missouri
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Restarting List Numbering in Word (Word 2003)

    I am vexed by this. In the template, it works fine. When I copy and paste text into a document based on this template, I receive problems.

    First, the code:

    <code> If Selection.Range.Style = "ListNumber" Or Selection.Range.Style = "ListAlpha" Then

    Set myLF = Selection.Range.ListFormat
    myLF.ApplyListTemplate ListTemplate:=myLF.ListTemplate, ContinuePreviousList:=False

    Else

    MsgBox "Selection is not a numbered or alpha list. " & _
    "Please select a numbered or alpha list and try again.", vbExclamation, _
    "Not a valid list"

    End If
    </code>

    The intent is simple enough. Restart the line with a 1. or an a., depending on what the style is. It works wonders in the original template.

    But for some reason, I'm having issues in production. For some reason, not only does it restart the numbering, but it also applies the style, "Action." This style exists, and we use it in this document. But it is not a numbered style. Furthermore, it redefines the Action style so that it is numbered. This is not at all what I intended to do with this code.

    Am I misusing the code somehow?

    Kevin

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

    Re: Restarting List Numbering in Word (Word 2003)

    Can you post the template (zipped)?

  3. #3
    Star Lounger
    Join Date
    Apr 2003
    Location
    Kansas City, Missouri
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Restarting List Numbering in Word (Word 2003)

    Sure thing. I'll go one better. I cut down the Word document in question and zipped it along with the template.

    You can see the problem when you go to the second page. Place the cursor on the last paragraph that says "Restart Numbering here." The toolbar has a button with "1/A" which is linked to the RestartNumbering Sub. You should see what happens to the "Action" style when the code is run.

    I don't see this problem in the original template, so I'm wondering if there's something ugly in this document (stupid thing had all sorts of styles, including duplicates).

    Kevin

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

    Re: Restarting List Numbering in Word (Word 2003)

    Click in one of the ListNumber paragraphs.
    Select Format | Bullets and Numbering...
    You'll see Action in the 1st level.
    Click Customize..., then More.
    You'll see that the 1st level is linked to the Action style.
    Link the first level to the ListNumber style instead.

  5. #5
    Star Lounger
    Join Date
    Apr 2003
    Location
    Kansas City, Missouri
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Restarting List Numbering in Word (Word 2003)

    Aha, code works fine, but the style got corrupted when I pasted all that text into the document.

    Once again, my old nemesis, Word Numbered Styles, challenges me. Thank you, Hans, for the prompt and excellent insight.

    Kevin

Posting Permissions

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