Automating call-out alignment in double-page documents

O

olitrans

I am using Word 2003 under Windows XP.

I have received a number of long double-page documents for a university
course, all of which are surprisingly well and consistently formatted. Most
body text paragraphs are accompanied by a short call-out in the outer margin.
The call-out style includes "Keep with next" so that it always stays glued to
the beginning of the home paragraph, even if the latter changes pages. The
formatting also ensures that the call-out stays in the outer margin, i.e.
left on even pages, right on odd pages.

Problem: The call-out has to be right-aligned on even pages, left-aligned on
odd pages, i.e. the flush side of the call-out is always nearest the body
text. In the German source text, this has been done manually, which is
obviously a nuisance and error-prone. Is there any way of automating the
alignment so that the call-out senses whether it is on an even or an odd page
and switches the paragraph alignment accordingly? Alternatively, could one
easily build a macro that would run through the document applying left and
right call-out styles appropriately depending on the page side?
 
O

olitrans

Many thanks for the suggestion, but it doesn't go far enough! The call-out is
indeed in a frame, which is already set to "outside". That takes care of
which side of the page the call-out appears. My problem is the text alignment
of the paragraph within the frame: right on even pages, left on odd. In the
past this has been done manually shortly before printing. I would like to
automate it, but cannot see any way of enabling the style to sense whether
the call-out is on an odd or even page and switch its horizontal text
alignment accordingly. I have even wondered about the possibility of a
formula triggering an appropriate macro, possibly tucked away as hidden text
in a paragraph number format. But I am basically an overworked translator,
not a Word wizard, and do not have unlimited time for experiments of this
kind.
--
olitrans
Technical Translator
Germany


Suzanne S. Barnhill said:
Assuming the "callout" is a frame, the position of the frame can be set to
"Outside." See http://sbarnhill.mvps.org/WordFAQs/MarginalText.htm
 
S

Suzanne S. Barnhill

Ah, I see. I misread your question. The answer would be in two separate
styles, one left-aligned and one right, but then you'd need a macro to run
through the document looking at each frame, figuring out which side of the
page it was on, and applying the appropriate style. It may be that this is
possible with VBA, but I wouldn't bet on it. It sounds as if either a
redesign or a continuation of the manual labor is indicated.



olitrans said:
Many thanks for the suggestion, but it doesn't go far enough! The call-out is
indeed in a frame, which is already set to "outside". That takes care of
which side of the page the call-out appears. My problem is the text alignment
of the paragraph within the frame: right on even pages, left on odd. In the
past this has been done manually shortly before printing. I would like to
automate it, but cannot see any way of enabling the style to sense whether
the call-out is on an odd or even page and switch its horizontal text
alignment accordingly. I have even wondered about the possibility of a
formula triggering an appropriate macro, possibly tucked away as hidden text
in a paragraph number format. But I am basically an overworked translator,
not a Word wizard, and do not have unlimited time for experiments of this
kind.
 
O

olitrans

Thank you, if only for confirmation that I have not missed an obvious
possibility. I was beginning to come to the same conclusion myself!
 
L

Lene Fredborg

I think the macro below will do what you want. The macro iterates through all
frames in the active document. If the frame has the Horizontal Position set
to "Outside", the macro finds out which page number the frame is on. In order
to find out whether the page number is even or odd, the number is divided by
2. If the remainder is 0, it is an even page and the text in the frame is
aligned left. Else, it is an odd page and the text in the frame is aligned
right.

You will need to run the macro each time changes to the document results in
frames moving from one page to another.

Sub FramesInMargin_ChangeAlignment_EvenOdd()
Dim oFrm As Frame

For Each oFrm In ActiveDocument.Frames
If oFrm.HorizontalPosition = wdFrameOutside Then
If oFrm.Range.Information(wdActiveEndPageNumber) Mod 2 = 0 Then
'even page number
oFrm.Range.ParagraphFormat.Alignment = wdAlignParagraphRight
Else
'odd page number
oFrm.Range.ParagraphFormat.Alignment = wdAlignParagraphLeft
End If
End If
Next oFrm

End Sub

If you need help on installing macros, see:
http://www.gmayor.com/installing_macro.htm

Note: Suzanne's last post appeared while I created and tested the macro
above. I have not introduced a second style.

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
S

Suzanne S. Barnhill

Ah, good approach, Lene. I hadn't thought of that possibility (but then I'm
not a coder).
 
O

olitrans

Many, many thanks - this looks impressive, and simpler than I expected! All
I need to do now is find the time to play with it!
 
L

Lene Fredborg

Suzanne, you should try coding some day. I am sure you would enjoy it (at
least after a little while).

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
S

Suzanne S. Barnhill

It's on my life list, so to speak (right up there with getting my daughter's
high school senior year scrapbook finished and getting back into the family
genealogy), but the last coding I did was Autocoder-IOCS for an IBM 1401,
and I have too much non-VBA-related work (and non-work) to do every day to
get into that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top