Keep With Before

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15646
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Keep With Before

Post by ChrisGreaves »

Don't get me started on Microsoft ...

I have a simple document with "Heading 1", "Heading 2" and "Heading 3" styled paragraphs, and within each heading, text in "Body Text" style.
Sadly some of the Body Text material splits across a page, and I'd rather have all the Body text on the same page as its immediate parent "Heading".
Office 2003 hasn't had "Keep With before" for at least the last 8 years, so I wrote the attached.

Use:
Place the text cursor anywhere in any paragraph of YOUR text style; it doesn't have to be Body Text.
Run the macro.

Method:

I'm using Selection so you can enjoy the blinking lights.
I leave your original selection in place when I'm done.
I use the style of the FIRST paragraph in your selection as my guiding light.
I turn OFF KeepWithNext and turn ON KeepTogether in every paragraph in the document.
Then for each paragraph in your chosen style, I backup one paragraph to the preceding paragraph and turn ON KeepWithNext.

This seems to work for me.

P.S. variations on a theme have this have been discussed elsewhere and else-elsewhere
You do not have the required permissions to view the files attached to this post.
He who plants a seed, plants life.