Word 2000 - STYLEREF problems across pages.

D

danielems

Hello,

I've look across the web and and Microsoft's help documents, and I
can't figure out how to make the STYLEREF field in my document header
work the way I want. I'll try to explain.

I have a document with chapters and verses. Each chapter header has a
style ("Heading 4") and each verse number has a style ("sup"). I'm
trying to get the header to tell me the first chapter and verse on the
page and the last chapter and verse on the page, e.g. John 2:20 -
John 3:9.

It works the way I want if a page only has one chapter, but when the
chapter changes in the middle of the page, then the header says John
3:20 - John 3:9 instead of John 2:20 - John 3:9. It is the same on
the screen and on a printed document.

Here are the header field codes:

{ STYLEREF "Heading 4" } : { STYLEREF "sup" } - { STYLEREF \l "Heading
4" } : { STYLEREF \l "sup" }

Is there a way to make with work? Word would have to look for the
most recent "Heading 4" style (possibly on a previous page) instead of
the first "Heading 4" style on this page. Is there another method I
should consider? I'm relatively comfortable with macros and writing
code, so don't hold back!

Thanks a bunch!

p.s. sorry if this has been asked before. If it has, then I didn't
have any luck finding it...
 
R

Robert M. Franz (RMF)

Hi Daniel

I have a document with chapters and verses. Each chapter header has a
style ("Heading 4") and each verse number has a style ("sup"). I'm
trying to get the header to tell me the first chapter and verse on the
page and the last chapter and verse on the page, e.g. John 2:20 -
John 3:9.

It works the way I want if a page only has one chapter, but when the
chapter changes in the middle of the page, then the header says John
3:20 - John 3:9 instead of John 2:20 - John 3:9. It is the same on
the screen and on a printed document.

Here are the header field codes:

{ STYLEREF "Heading 4" } : { STYLEREF "sup" } - { STYLEREF \l "Heading
4" } : { STYLEREF \l "sup" }

Is there a way to make with work? Word would have to look for the
most recent "Heading 4" style (possibly on a previous page) instead of
the first "Heading 4" style on this page. Is there another method I
should consider? I'm relatively comfortable with macros and writing
code, so don't hold back!

I don't see STYLEREF doing the job here, sorry.

You can only instruct it to look from the top or bottom of the page, but
any target actually _on_ the page will certainly be found.

In case of outline numbering à la 1/1.1/1.1.1 etc., you can do very
limited comparisions between what STYLEREF 1 and STYLEREF 2 finds, and
act accordingly (say, to see whether the found H2 is part of the found
H1 or actually of the H1 preceeding it), but I don't think you can use
that approach in your case.

One more fluent in VBA might be able to turn up some code which runs
through all pages and inserts some text (in a dedicated style, think
"white" font color, maybe in a frame anchored to top and bottom
paragraph of the page) that STYLEREFS can pick up; but this is a task
*loaded* with traps.

HTH
Robert
 
S

Stefan Blom

Daniel,

Sometimes, you can "cheat" by using a character style, appropriately
applied to certain paragraphs, and have a STYLEREF field pick up that
one instead of the actual paragraph styles. I'm not sure if/how this
would work for you, though.

Another thing to consider: Since the STYLEREF fields you are using now
work as long as there is only a single Heading 4 on each page, you
could add "Page break before" formatting to that style.

--
Stefan Blom
Microsoft Word MVP


in message
 

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