• Change tab positions in numbered and bulleted lists

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Change tab positions in numbered and bulleted lists

    Author
    Topic
    #501439

    Hi I have to change the tab positions of bulleted and numbered lists for more than 2,000 pages of Word documents. There are lists on every page. What is the fastest way for me to do this?

    I tried using styles, but the numbered lists and the bulleted lists have the same style (it seems). Also when I selected a text and then clicked on “select all instances of this style” and then made my tab change, it changed the numbering so that all of the lists continue numbering from the beginning. Then when I clicked on “restart numbering,” the list went back to the original tab stops.

    Currently I’m using a couple macros which simply move the bullets and numbers to the correct position, but with these (very simple) macros I have to select the first level bullets and then hit the first macro; Then I have to select the second level bullets and hit the second macro and then the third level and so on.

    Anybody have a good idea of either a better macro that will automate this or a way to do this with styles?

    Thanks!

    Darren

    Viewing 10 reply threads
    Author
    Replies
    • #1520565

      A macro to do that kind of processing would be very document-specific. A detailed knowledge is required of the existing indenting & tab structure plus the desired indenting & tab structure. It all falls in a heap if the existing indenting & tab structure isn’t consistent.

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

      • #1521457

        So you think a macro could be the way to go?

        These documents were created by a computer aided translation program. That means the tab positions and line starting positions are pretty consistent; they just aren’t in the right places.

        I made a macro to move the first level bullet points to the right spot, but I noticed that they will move everything to that spot no matter where it is starting from. I need a way to say something like

        Code:
        in this document
        IF the line starts here with a bullet, move it here.
        IF the line starts here without a bullet, move it here.
        If the line starts there with a bullet, move it there.
        If the line starts there without a bullet, move it there.
        and so on . . .
        

        Most websites about VBA focus on Excel rather than word, so I’m having a hard time getting started on this.

        Any ideas of how the basic syntax of my code should be or if VBA can even do that?

        Thanks so much for your response last week! 🙂

        A macro to do that kind of processing would be very document-specific. A detailed knowledge is required of the existing indenting & tab structure plus the desired indenting & tab structure. It all falls in a heap if the existing indenting & tab structure isn’t consistent.

    • #1520566

      Hi Darren
      More details please.
      I am sure we have all seen too many ‘documents from hell’ to offer a quick solution.

      2,000 pages of Word documents

      So how many documents roughly?
      Is there a common template? Other than normal.dot(?)
      How many authors have the docs passed through?
      Do the documents have lots of direct formatting?
      Is there any consistency between the documents?
      How old are the documents?

      have the same style (it seems)

      What style?
      It may be comparatively simple to attach a template with the desired style definitions and update the documents.
      IMHO it rarely is. Sooner rather than later you end up working on a document by document basis.

      Any samples would be helpful, docs or macros.
      Cheers
      Geof

      • #1521461

        Hi Geof,

        41640-Screen-Shot-2015-08-10-at-10.01.50-AM
        41641-Screen-Shot-2015-08-10-at-9.59.57-AM
        Basically one of these is how it looks now. The one with some highlighting at the bottom is how it’s supposed to look.

        When I tried using styles to change everything, it didn’t work properly. Notice that under the bullet points there are paragraphs that line up under the bullet point text. when i applied styles to change everything, those paragraphs would become second level bullet points instead of paragraphs under the first level bullet points. Also all of the numbered lists would number consecutively. :o:

        In answer to your questions:
        -There are about 20 documents of between 140-300 pages.
        -They are consistent because they have been generated by a computer assisted translation program. Basically a translator enters the translation into the program and the program will pop the translation back into the “same” formatting as the original source document. So they are all pretty internally consistent having been done by a computer.

        Do you think a macro might be the silver bullet? or working with styles?

        Thanks so much for your expert advice!

        Darren

    • #1521463

      I noticed that this macro will remove the tab stop only if it is at 0.5 inches.

      I want the next part to run only if the starting point is at 0.5 inches too. I just don’t know the syntax. Anybody know?

      Code:
      Sub fstlvlnobullts()
      ‘
      ‘ fstlvlnobullts Macro
      ‘ move the non bulleted paragraph under the first level bullet from .5 to .25 and remove the tabstop at .5
      ‘
          
          Selection.ParagraphFormat.TabStops(InchesToPoints(0.5)).Clear
      
          With Selection.ParagraphFormat
              .LeftIndent = InchesToPoints(0.25)
              .SpaceBeforeAuto = False
              .SpaceAfterAuto = False
          End With
      End Sub
      
    • #1521551

      If you attach a sample document with all the existing standard structure to a post, plus another with all the desired standard structure, it should be possible to craft a macro to do most, if not all, of the conversion.

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

      • #1521799

        If you attach a sample document with all the existing standard structure to a post, plus another with all the desired standard structure, it should be possible to craft a macro to do most, if not all, of the conversion.

        Thanks for taking the time to look at this mess. I’ve attached a before and after file. This is just a short example of the changes I need to make in these files.

        I think the main problem that I’m having is that I don’t know how to select a paragraph based on its indentation. I want to say “if it’s indented at .25 inches, move it to .0 inches”

        41657-before

        41658-after

    • #1521553

      The macros you need are not particularly difficult to code. The trick is finding an attribute of each paragraph that uniquely identifies the style that should be applied to it. For instance, if you could determine the type of paragraph by amount of left indent on the paragraph then the code might look like this

      Code:
      Sub ApplyStyles()
        Dim aPar As Paragraph
        For Each aPar In ActiveDocument.Paragraphs
          Select Case aPar.LeftIndent
            Case 36
              aPar.Style = "List Bullet"
            Case 72
              aPar.Style = "List Bullet 2"
          End Select
        Next aPar
      End Sub

      The basic process to make use of a macro like that is to first develop a template that contains all the styles you want to use. Then you attach that template to one of the documents and you refresh the styles from the template. Then you run the macro on that document.

      • #1521557

        That looks like it’s exactly the thing.

        I basically need to make a macro that will say

        Code:
        If the LeftIndent is -0.08 inches Then
        Make the LeftIndent 0 inches
        If the LeftIndent is 0.25 inches Then
        make the LeftIndent 0 inches
        If the LeftIndent is 0.5 inches Then
        Make the LeftIndent 0.25 inches
        and so on
        

        Are you saying that I can’t really get that to work on my document unless I first do the thing with the template that you recommended? The current document is pretty consistent because it was generated by RoboHelp.

        I’m afraid that if I do a template, it will put all of the numbers and tab stops off. That’s what happened when I tried using styles to do it. I’ll try a template though.

        I’ll try to put some dummy text in the document and attach it showing the way it is and the way it needs to be.

        I really appreciate your help.:o

    • #1521581

      Darren

      You can do whatever you like but if you are not using styles then you will always have to manage global updates by some dodgy macro method like that above. If you start using styles then you can simply modify the style to make global changes. You don’t need to attach a template but it makes life a lot easier in the future if you did.

      Word uses points (72 per inch) for its measurements so you could modify the macro I posted to cater for your actual measurements and change the paragraphs locally if you wish.

      • #1521795

        Darren

        You can do whatever you like but if you are not using styles then you will always have to manage global updates by some dodgy macro method like that above. If you start using styles then you can simply modify the style to make global changes. You don’t need to attach a template but it makes life a lot easier in the future if you did.

        Word uses points (72 per inch) for its measurements so you could modify the macro I posted to cater for your actual measurements and change the paragraphs locally if you wish.

        Ok yeah, that’s true. Actually though these documents are crazy enough that changing the styles doesn’t seem to work. The first, second, and third level points all think they are first level points. I created a style for bulleted lists and then applied it to a list with first and second level points, and they all became first level points. So I think I’ll have to just do a macro that says “if the point is at -.08 inches then it needs to be moved to .0 inches.

        This is unfortunately a bit of a meaningless task. When the software that these documents are about is updated in the future, the help guides will be spit out of Robohelp again with all the same problems as these documents. Therefore, my changing the styles won’t really provide value for the company down the road after the software is updated again. So I don’t mind being dodgy. I just need to make it look right in the least time possible.:cool:

        With that macro you gave an example of before, is there a way to select paragraphs based on their tab stops rather than based on their style?

        Thanks!

    • #1521852

      There is some grey in what you asked for but this macro should show you how it can be done. Your before doc shows three different indents on your bullets but your after doc has turned this into two.

      Code:
      Sub ChangeIndents()
        Dim aPar As Paragraph
        For Each aPar In ActiveDocument.Paragraphs
          Select Case aPar.LeftIndent
            Case Is < 0
              aPar.LeftIndent = 0
            Case 36, 72, 108
              aPar.LeftIndent = aPar.LeftIndent / 2
          End Select
        Next aPar
      End Sub
      • #1521932

        Well, thanks for the idea. It was helpful to see how it should be structured.

        Unfortunately it didn’t seem to work for me. I don’t know what the deal is.

        Code:
        Sub ChangeIndents()  
          Dim aPar As Paragraph
          For Each aPar In ActiveDocument.Paragraphs
            Select Case aPar.LeftIndent
              ‘ first level bullets
              Case Is < InchesToPoints(0)
                aPar.LeftIndent = InchesToPoints(0)
            ' first level numbers
            Case InchesToPoints(0.25)
                aPar.LeftIndent = InchesToPoints(0)
            ' first level number note box
            Case InchesToPoints(0.75)
                aPar.LeftIndent = InchesToPoints(0.25)
                ' second level
              Case InchesToPoints(0.42)
                aPar.LeftIndent = InchesToPoints(0.25)
                ' second level note box
                Case InchesToPoints(0.92)
                aPar.LeftIndent = InchesToPoints(0.5)
                ' third level
            Case InchesToPoints(0.58)
                aPar.LeftIndent = InchesToPoints(0.5)
            End Select
          Next aPar
        End Sub
        
        
        

        I did this way and I also did it with just points, not InchesToPoints(). Neither brought up an error message, and neither moved any of the indents.:confused:

    • #1521934

      Hm,

      Well I ran just the code you wrote and the second half of it worked

      Code:
        Case 36, 72, 108
              aPar.LeftIndent = aPar.LeftIndent / 2

      but not the first half

      Code:
      Case Is < 0
              aPar.LeftIndent = 0

      .
      :-/

    • #1521977

      My two-cents’ worth:

      Machine-generated translations/conversions in Word are always an editing nightmare. The people who write that software do not use Word structures properly.

      Undertaking major editing without using Styles is an exercise in futility and frustration. Focus your macros on applying styles to like-formatted text that is your target. Then apply properly formatted styles from another template.

      Tabs and indents in numberedor bulletedlists that are not set up linked to Styles per the instructions given by Shauna Kelly’s pages (linked previously) are doomed.

    • #1522029

      Darren

      FWIW, I agree with Charles that you really should be using styles. The major problem with doing it without styles is that you can’t run the macro a second time on the same document.

      However, the code I supplied worked fine with the sample document you provided. If you find it doesn’t work on your documents then perhaps your sample was not representative of your actual files. For instance, in your sample there were no negative indented paragraphs so that part of the Case statement showed no visible changes in the sample file.

    • #1522625

      If this were my project, I’d be inclined to define some Styles for each of the formats you require (e.g. List-numbered & bulleted), then programmatically adding those Styles to the documents and applying them to the relevant paragraphs. That has real advantages if someone want to vary the formatting later on. However, your ‘after’ document isn’t even consistent with its font usage in paragraphs at the same level – different point sizes are uses and some have bolded text while others don’t. I don’t know if that’s intentional, or if it’s just something that’s been overlooked. If it’s intentional, one could still do the changes via Styles, but more would be needed; if not, applying the Styles as suggested would also correct the fonts at the same time.

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

    Viewing 10 reply threads
    Reply To: Change tab positions in numbered and bulleted lists

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: