Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    New Lounger
    Join Date
    Aug 2015
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Change tab positions in numbered and bulleted lists

    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

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    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
    [MS MVP - Word]

  3. #3
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Levin, Manawatu-Wanganui, New Zealand
    Posts
    324
    Thanks
    9
    Thanked 28 Times in 26 Posts
    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
    Last edited by geofrichardson; 2015-08-07 at 18:56.

  4. #4
    New Lounger
    Join Date
    Aug 2015
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macros

    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! :-)

    Quote Originally Posted by macropod View Post
    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.

  5. #5
    New Lounger
    Join Date
    Aug 2015
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Formatting documents

    Hi Geof,

    Screen Shot 2015-08-10 at 10.01.50 AM.png
    Screen Shot 2015-08-10 at 9.59.57 AM.png
    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.

    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

  6. #6
    New Lounger
    Join Date
    Aug 2015
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post how to run a macro under only specific condition.

    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

  7. #7
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    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
    [MS MVP - Word]

  8. #8
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    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.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  9. #9
    New Lounger
    Join Date
    Aug 2015
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Looking Good!

    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.

  10. #10
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    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.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  11. #11
    New Lounger
    Join Date
    Aug 2015
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dodgyness

    Quote Originally Posted by Andrew Lockton View Post
    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.

    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!

  12. #12
    New Lounger
    Join Date
    Aug 2015
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post example of docs

    Quote Originally Posted by macropod View Post
    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"

    before.docx

    after.docx

  13. #13
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    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
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  14. #14
    New Lounger
    Join Date
    Aug 2015
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Well . . .

    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.

  15. #15
    New Lounger
    Join Date
    Aug 2015
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    .
    :-/

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

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