Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Feb 2002
    Location
    Fort Collins, Colorado, USA
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Keeping flush & centered tab stops that way (all)

    I frequently use styles requiring a "flush right" setting--for example, the chapter number in a header or page number in a List of Figures. WordPerfect had a command to do just that, but Word does not (as far as I can tell). In Word, I have to insert a right-aligned tab stop and position it at the right-hand margin. That's fine, until I reformat the page with different margins--the tab stop does not "stick" to the margin setting, so it's no longer right flush. I have to manually readjust it to the new right margin location.

    A similar problem exists with the page number in a header, which is centered on the page. Word intends for you to position this using a certer tab stop, but it's only centered according to the margins in effect at the time you enter the header. After that, it won't stay centered when the margins change.

    Some of my documents are for foreign use, and I often have to reformat them for A4 paper vs. 8.5x11 paper, with different margin settings. I'm getting tired of adjusting all these tab stops every time I make this change. Does anyone have a better suggestion?

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

    Re: Keeping flush & centered tab stops that way (all)

    Not the solution you are asking for, but a workaround.

    If you put the appropriate tab stops into styles and create different tempates for A4 and US paper sizes then you won't have to keep editing things.

    StuartR

  3. #3
    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: Keeping flush & centered tab stops that way (all)

    Seems best to define counterpart styles:

    Header: Center tab at 3.25", Right tab at 6.5" (if you use 1" margins)
    HeaderA4: Center tab at 3.14", Right tab at 6.27" (if you use 1" margins)

    etc. Then use a macro to swap the paper size and styles at the same time. It can be as simple as several Find and Replace operations, and probably doesn't need to be this cumbersome:
    <pre>Option Explicit

    Sub SwapLetterAndA4()
    ' Jefferson Scher 3/8/2003
    Dim lngNewSize As Long
    With ActiveDocument.PageSetup
    ' Check Paper Size, store setting, change margins
    If .PaperSize = wdPaperLetter Then
    lngNewSize = wdPaperA4
    .PaperSize = lngNewSize
    ElseIf .PaperSize = wdPaperA4 Then
    lngNewSize = wdPaperLetter
    .PaperSize = lngNewSize
    Else
    'We don't do anything!
    Exit Sub
    End If
    End With
    With ActiveDocument.Content.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = ""
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    If lngNewSize = wdPaperA4 Then
    'change a style in the main document body
    '.Style = ActiveDocument.Styles("Header")
    '.Replacement.Style = ActiveDocument.Styles("HeaderA4")
    '.Execute Replace:=wdReplaceAll
    ElseIf lngNewSize = wdPaperLetter Then
    'change a style in the main document body
    '.Style = ActiveDocument.Styles("HeaderA4")
    '.Replacement.Style = ActiveDocument.Styles("Header")
    '.Execute Replace:=wdReplaceAll
    End If
    'Repeat as needed
    .ClearFormatting
    .Replacement.ClearFormatting
    End With
    Dim sect As Section, hdrftr As HeaderFooter
    For Each sect In ActiveDocument.Sections
    For Each hdrftr In sect.Headers
    With hdrftr.Range.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = ""
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    If lngNewSize = wdPaperA4 Then
    .Style = ActiveDocument.Styles("Header")
    .Replacement.Style = ActiveDocument.Styles("HeaderA4")
    .Execute Replace:=wdReplaceAll
    ElseIf lngNewSize = wdPaperLetter Then
    .Style = ActiveDocument.Styles("HeaderA4")
    .Replacement.Style = ActiveDocument.Styles("Header")
    .Execute Replace:=wdReplaceAll
    End If
    'Repeat as needed
    .ClearFormatting
    .Replacement.ClearFormatting
    End With
    Next hdrftr
    For Each hdrftr In sect.Footers
    With hdrftr.Range.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = ""
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    If lngNewSize = wdPaperA4 Then
    'change a style in the footer
    '.Style = ActiveDocument.Styles("Header")
    '.Replacement.Style = ActiveDocument.Styles("HeaderA4")
    '.Execute Replace:=wdReplaceAll
    ElseIf lngNewSize = wdPaperLetter Then
    'change a style in the footer
    '.Style = ActiveDocument.Styles("HeaderA4")
    '.Replacement.Style = ActiveDocument.Styles("Header")
    '.Execute Replace:=wdReplaceAll
    End If
    'Repeat as needed
    .ClearFormatting
    .Replacement.ClearFormatting
    End With
    Next hdrftr
    Next sect
    End Sub</pre>

    I only tested with the Header/HeaderA4, but I think it should work more generally. Make sense?

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Spokane, Washington, USA
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Keeping flush & centered tab stops that way (all)

    So long as the only item on that line is the page number you want right aligned or centered, why not use the paragraph alignment? Use the keyboard shortcuts Ctrl-R to right align and Ctrl-E to center. You can also use the toolbar buttons or do it the long way from the menu under Format - Paragraph then choose the "General Alignment."
    Samantha

    Everything in excess! To enjoy the flavor of life, take big bites. Moderation is for monks!
    Robert A. Heinlein - Time Enough for Love

Posting Permissions

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