Results 1 to 3 of 3
  1. #1
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Proportionally change all indents (Word 2002 SP-2)

    In WordPerfect, if I change a document from a 12-point font to a 10-point font and I make a corresponding change to the tab settings at the top of the document (from every 0.5" to every 0.3"), the tab changes "ripple through the document" (as Word aficionados are wont to say) and the ripples include changes to the paragraph indentations (since they're based on the tab settings).

    I'm trying to write a macro that will achieve the same effect in Word. My first approach was this:

    Dim s As Word.Style

    For Each s In ActiveDocument.Styles
    If s.Type = wdStyleTypeParagraph Then
    s.ParagraphFormat.LeftIndent = 0.6 * s.ParagraphFormat.LeftIndent
    s.ParagraphFormat.FirstLineIndent = 0.6 * s.ParagraphFormat.FirstLineIndent
    End If
    Next s

    The most obvious problem with this approach is that, for a style based on another style, the proportional reduction can end up being applied twice or more (so that 0.5" ends up as 0.18" rather than 0.3", for example).

    I can come up with non-clever, tedious solutions all by myself. If anyone has a solution that's clever or non-tedious (preferably both), please share.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Proportionally change all indents (Word 2002 SP-2)

    I'm not sure that "manuals of style" require that you change the size of the indent, but... naturally you should change Normal.dot first, as many other styles will use its settings. After that, I'm sure there's a way to determine the "new/different" elements of a particular style. The Styles dialog does it, as does the Styles task pane (esp. in reveal formatting mode). Much easier than calculating it for yourself, although you could do that, too. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Also, with respect to the fixed tabs that by default fall at every 0.5", I believe there can only be one setting per document. Perhaps you could set those first, then use that measurement in your code to set the LeftIndent, rather than using a formula (although having 0.6*0 come out zero is a nice feature).

    The above does not reflect deep thought; your mileage may vary.

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

    Re: Proportionally change all indents (Word 2002 SP-2)

    If I needed to do this for multiple documents then I would define two templates. One with 10 point text and small indents, the other with 12 point text and larger indents. (presumably for each style, although you may have many of your styles based on Normal).

    It would then be a simple matter of visiting the Templates and Add Ins... dialog to switch templates.

    StuartR

Posting Permissions

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