Results 1 to 10 of 10
  1. #1
    Lounger
    Join Date
    Jun 2004
    Location
    Williamstown, Victoria, Australia
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro to Renumber Headings (Word 2002 SP3)

    I'm looking for a macro that will re-number headings. I have 10 documents, Chapter 1 to 10, and I would like to re-number the heading levels according to the Chapters and at the same time retain the formating/tabs, etc., of the heading styles. I have found a macro in the Lounge but it doesn't retain the existing style formatting. Sample attached FYI.
    Thanks.
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Macro to Renumber Headings (Word 2002 SP3)

    Is the existing formatting applied as manual formatting, or by the current style?
    Can you point us at the Macro you found on the lounge?

    StuartR

  3. #3
    Lounger
    Join Date
    Jun 2004
    Location
    Williamstown, Victoria, Australia
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to Renumber Headings (Word 2002 SP3)

    Stuart
    The existing formatting is applied by the current style (H1, H2, H3, etc.). I did a little more searching and found a macro provided by Andrew Lockton and I was able to adjust this macro to my current tab settings but when I run it I get an error message (see attached) but it still works.

    The macro was at Post 25250, Re Outline Numbering.
    Thanks.
    Attached Files Attached Files

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Macro to Renumber Headings (Word 2002 SP3)

    Does the error come about because you are starting the numbering of one of the items at 0 rather than 1?

    And what are you doing working on a beautiful day like today?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  5. #5
    Lounger
    Join Date
    Jun 2004
    Location
    Williamstown, Victoria, Australia
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to Renumber Headings (Word 2002 SP3)

    Hi Andrew
    Don't think I was starting anything at 0 but I could have missed something when I "butchered" your macro. My numbering is:
    1
    1.1
    1.1.1
    1.1.1.1
    etc.

    And yes it is a lovely day but I "volunteered" to help a friend re-format her PHD thesis!!!!

    Cheers

  6. #6
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Macro to Renumber Headings (Word 2002 SP3)

    Do you now have the document formatted the way you want?

    That's a strange error message, it might be interesting to single step the Macro to see where it is coming from.

    StuartR

  7. #7
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Macro to Renumber Headings (Word 2002 SP3)

    Renyne, the macro asks the user for the numbers they want the document to start at. If you don't answer with a digit for each of the three questions then you might run into problems. Do you know what line the code falls over on?

    That macro is pretty long in the tooth but it used to do the job when the right type of answer was provided. A newer, more flexible one involves a user form to guide the user a bit more.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  8. #8
    Lounger
    Join Date
    Jun 2004
    Location
    Williamstown, Victoria, Australia
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to Renumber Headings (Word 2002 SP3)

    When the dialogue box appears asking what Heading 1 starts at I enter the relevant number, say 6, and the prompts for headings 2 and 3 I leave as 1. After I hit hit the OK button 3 times the error message appears and I click OK and it renumbers Heading 1 to "6".
    Unfortunately, my macro knowledge is limited so I am not sure what step/line it falls over on.

  9. #9
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Macro to Renumber Headings (Word 2002 SP3)

    Renyne

    I just tested the macro that you referred to and discovered the error in it. The ErrorHandler code is being processed even though there isn't an error there. Add a new line (Exit Sub) at the end just above the line that says ErrorHandler: - The code should then look as shown below
    <pre> myListGallery.Name = "Headings"
    Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=myListGallery, _
    ContinuePreviousList:=True, ApplyTo:=wdListApplyToWholeList
    Exit Sub
    ErrorHandler:
    MsgBox "Error: " & Err.Number & vbCr & Err.Description
    End Sub</pre>

    Andrew Lockton, Chrysalis Design, Melbourne Australia

  10. #10
    Lounger
    Join Date
    Jun 2004
    Location
    Williamstown, Victoria, Australia
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to Renumber Headings (Word 2002 SP3)

    Thank you Andrew, I adjusted the code and it works perfectly.
    Cheers.

Posting Permissions

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