Results 1 to 6 of 6
  1. #1
    3 Star Lounger Omega3's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, California, USA
    Posts
    343
    Thanks
    2
    Thanked 1 Time in 1 Post
    In a long document, I want to run a macro to check every paragraph to make sure that it does not cross over to the next page. If it does, set the paragraph property to “Keep lines together.” How do I check if the paragraph crosses over to the next page?

    Do I have to check the page number of the beginning of the paragraph with the page number of the end of the paragraph? If so, how would I determine the page number? Or, is there an easier way?
    You know it's time to diet when you push away from the table and the table moves.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Why don't you select the entire document (Ctrl+A) and tick the "Keep together" check box in the Line and Page Breaks tab of the Format Paragraph dialog? This will have the same effect, without needing any code.

  3. #3
    3 Star Lounger Omega3's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, California, USA
    Posts
    343
    Thanks
    2
    Thanked 1 Time in 1 Post
    [quote name='HansV' post='786859' date='30-Jul-2009 11:41']Why don't you select the entire document (Ctrl+A) and tick the "Keep together" check box in the Line and Page Breaks tab of the Format Paragraph dialog? This will have the same effect, without needing any code.[/quote]

    Well I wasn't thinking of making every paragraph in the document "keep together" but yes that would work. After doing that, when I turn on the pilcrow button I will see small black square symbols all down the left margin once for every paragraph in the document but I think my users could live with that. Thank you!
    You know it's time to diet when you push away from the table and the table moves.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The problem with making individual paragraphs keep together if they cross a page boundary is that this pushes the text below such paragraphs down the page. This could cause new paragraphs to cross a page boundary, so you would need to repeat the process, and this could cause yet other paragraphs to cross a page boundary, etc. etc. So it's much more efficient to set ALL paragraphs to keep together.

  5. #5
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    [quote name='HansV' post='786875' date='31-Jul-2009 05:07']The problem with making individual paragraphs keep together if they cross a page boundary is that this pushes the text below such paragraphs down the page. This could cause new paragraphs to cross a page boundary, so you would need to repeat the process, and this could cause yet other paragraphs to cross a page boundary, etc. etc. So it's much more efficient to set ALL paragraphs to keep together.[/quote]
    Another reason for setting all paragraphs with the 'keep together' attribute is that, if you edit the document after setting only some of the paragraphs with the 'keep together' attribute, that editing could mess up all the work you've already done. Personally, I'd manage the 'keep together' attribute via Style formatting.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  6. #6
    3 Star Lounger Omega3's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, California, USA
    Posts
    343
    Thanks
    2
    Thanked 1 Time in 1 Post
    [quote name='macropod' post='786934' date='30-Jul-2009 18:51']Another reason for setting all paragraphs with the 'keep together' attribute is that, if you edit the document after setting only some of the paragraphs with the 'keep together' attribute, that editing could mess up all the work you've already done. Personally, I'd manage the 'keep together' attribute via Style formatting.[/quote]

    Sorry for the late reply. I tried getting back into the Lounge on Thursday but I just couldn't get in and I was off on Friday. Both yours and Han's suggestions make sense. I like the idea of managing them via the Style formatting. Thanks.
    You know it's time to diet when you push away from the table and the table moves.

Posting Permissions

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