A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Page Layout
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Automating call-out alignment in double-page documents



 
 
Thread Tools Display Modes
  #1  
Old August 1st, 2007, 04:44 PM posted to microsoft.public.word.pagelayout
olitrans
external usenet poster
 
Posts: 4
Default Automating call-out alignment in double-page documents

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?
--
olitrans
Technical Translator
Germany
  #2  
Old August 1st, 2007, 11:11 PM posted to microsoft.public.word.pagelayout
Suzanne S. Barnhill
external usenet poster
 
Posts: 31,786
Default Automating call-out alignment in double-page documents

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

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"olitrans" wrote in message
...
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?
--
olitrans
Technical Translator
Germany


  #3  
Old August 2nd, 2007, 06:24 AM posted to microsoft.public.word.pagelayout
olitrans
external usenet poster
 
Posts: 4
Default Automating call-out alignment in double-page documents

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" wrote:

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

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"olitrans" wrote in message
...
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?
--
olitrans
Technical Translator
Germany



  #4  
Old August 2nd, 2007, 02:25 PM posted to microsoft.public.word.pagelayout
Suzanne S. Barnhill
external usenet poster
 
Posts: 31,786
Default Automating call-out alignment in double-page documents

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.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"olitrans" wrote in message
...
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" wrote:

Assuming the "callout" is a frame, the position of the frame can be set

to
"Outside." See http://sbarnhill.mvps.org/WordFAQs/MarginalText.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the

newsgroup so
all may benefit.

"olitrans" wrote in message
...
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?
--
olitrans
Technical Translator
Germany




  #5  
Old August 2nd, 2007, 02:48 PM posted to microsoft.public.word.pagelayout
olitrans
external usenet poster
 
Posts: 4
Default Automating call-out alignment in double-page documents

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


"Suzanne S. Barnhill" wrote:

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.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"olitrans" wrote in message
...
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" wrote:

Assuming the "callout" is a frame, the position of the frame can be set

to
"Outside." See http://sbarnhill.mvps.org/WordFAQs/MarginalText.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the

newsgroup so
all may benefit.

"olitrans" wrote in message
...
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?
--
olitrans
Technical Translator
Germany




  #6  
Old August 2nd, 2007, 02:48 PM posted to microsoft.public.word.pagelayout
Lene Fredborg
external usenet poster
 
Posts: 1,294
Default Automating call-out alignment in double-page documents

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


"Suzanne S. Barnhill" wrote:

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.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"olitrans" wrote in message
...
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" wrote:

Assuming the "callout" is a frame, the position of the frame can be set

to
"Outside." See http://sbarnhill.mvps.org/WordFAQs/MarginalText.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the

newsgroup so
all may benefit.

"olitrans" wrote in message
...
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?
--
olitrans
Technical Translator
Germany




  #7  
Old August 2nd, 2007, 04:52 PM posted to microsoft.public.word.pagelayout
Suzanne S. Barnhill
external usenet poster
 
Posts: 31,786
Default Automating call-out alignment in double-page documents

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

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Lene Fredborg" wrote in message
...
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


"Suzanne S. Barnhill" wrote:

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.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the

newsgroup so
all may benefit.

"olitrans" wrote in message
...
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" wrote:

Assuming the "callout" is a frame, the position of the frame can be

set
to
"Outside." See http://sbarnhill.mvps.org/WordFAQs/MarginalText.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the

newsgroup so
all may benefit.

"olitrans" wrote in message
...
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?
--
olitrans
Technical Translator
Germany





  #8  
Old August 2nd, 2007, 05:12 PM posted to microsoft.public.word.pagelayout
olitrans
external usenet poster
 
Posts: 4
Default Automating call-out alignment in double-page documents

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!
--
olitrans
Technical Translator
Germany


"Lene Fredborg" wrote:

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


"Suzanne S. Barnhill" wrote:

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.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"olitrans" wrote in message
...
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" wrote:

Assuming the "callout" is a frame, the position of the frame can be set

to
"Outside." See http://sbarnhill.mvps.org/WordFAQs/MarginalText.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the

newsgroup so
all may benefit.

"olitrans" wrote in message
...
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?
--
olitrans
Technical Translator
Germany




  #9  
Old August 2nd, 2007, 07:02 PM posted to microsoft.public.word.pagelayout
Lene Fredborg
external usenet poster
 
Posts: 1,294
Default Automating call-out alignment in double-page documents

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


"Suzanne S. Barnhill" wrote:

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

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Lene Fredborg" wrote in message
...
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


"Suzanne S. Barnhill" wrote:

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.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the

newsgroup so
all may benefit.

"olitrans" wrote in message
...
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" wrote:

Assuming the "callout" is a frame, the position of the frame can be

set
to
"Outside." See http://sbarnhill.mvps.org/WordFAQs/MarginalText.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so
all may benefit.

"olitrans" wrote in message
...
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?
--
olitrans
Technical Translator
Germany






  #10  
Old August 2nd, 2007, 10:38 PM posted to microsoft.public.word.pagelayout
Suzanne S. Barnhill
external usenet poster
 
Posts: 31,786
Default Automating call-out alignment in double-page documents

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.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Lene Fredborg" wrote in message
...
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


"Suzanne S. Barnhill" wrote:

Ah, good approach, Lene. I hadn't thought of that possibility (but then

I'm
not a coder).

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the

newsgroup so
all may benefit.

"Lene Fredborg" wrote in message
...
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


"Suzanne S. Barnhill" wrote:

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.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the

newsgroup so
all may benefit.

"olitrans" wrote in message
...
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" wrote:

Assuming the "callout" is a frame, the position of the frame can

be
set
to
"Outside." See

http://sbarnhill.mvps.org/WordFAQs/MarginalText.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so
all may benefit.

"olitrans" wrote in message
...
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?
--
olitrans
Technical Translator
Germany







 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:10 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.