Consulting

Results 1 to 5 of 5

Thread: Line feeding last line of paragraph on a doc into next page

  1. #1
    Knowledge Base Approver
    Space Cadet
    VBAX Tutor sandam's Avatar
    Joined
    Jan 2005
    Location
    London
    Posts
    292
    Location

    Line feeding last line of paragraph on a doc into next page

    Is it possible to link two paragraphs so that If the second paragraph is pushed on a second page, the trailing line of the preceding paragraph is also pushed on to the same page, but only that one line?

    Eg.
    page one
    ---------------------------------------------------------
    ParaOneJUNKParaOneJUNKParaOneJUNKParaOneJUNK
    ParaOneJUNKParaOneJUNKParaOneJUNKParaOneJUNK

    ParaTwoJUNKParaTwoJUNKParaTwoJUNKParaTwoJUNK
    ParaTwoJUNKParaTwoJUNKParaTwoJUNKParaTwoJUNK

    then becomes

    page one
    ----------------------------------------------------------
    ParaOneJUNKParaOneJUNKParaOneJUNKParaOneJUNK

    page two
    ----------------------------------------------------------
    ParaOneJUNKParaOneJUNKParaOneJUNKParaOneJUNK

    ParaTwoJUNKParaTwoJUNKParaTwoJUNKParaTwoJUNK
    ParaTwoJUNKParaTwoJUNKParaTwoJUNKParaTwoJUNK

    Hope this all makes sense??

    Andrew;?
    Nothing annoys a non-conformist more than other non-conformists who refuse to conform to the rules of non-conformity.


    Confused is my normal state of mind


  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    hmmmm, yes I just remebered how much I hate programming in Word...
    I've sort of worked somthing out for working out which para is where. I'll have to leave the rest to you for now (real work arriving...bah!)
    [VBA]Sub test()

    'Dim objParagraph As Paragraph
    Dim i As Long
    Dim iCurrent As Long
    Dim iPrev As Long

    For i = 1 To ActiveDocument.Paragraphs.Count
    iCurrent = ActiveDocument.Paragraphs(i).Range.Information(wdActiveEndAdjustedPageNumbe r)
    If i > 1 Then
    iPrev = ActiveDocument.Paragraphs(i - 1).Range.Information(wdActiveEndAdjustedPageNumber)
    End If
    If iCurrent = iPrev + 1 And iPrev <> 0 Then
    MsgBox iCurrent & ":" & iPrev
    'search ActiveDocument.Paragraphs(i - 1) for the second "." from the end
    'grab from that char pos to end of para and move... some how
    End If
    Next

    End Sub[/VBA]
    K :-)

  3. #3
    Knowledge Base Approver
    Space Cadet VBAX Tutor sandam's Avatar
    Joined
    Jan 2005
    Location
    London
    Posts
    292
    Location
    thanks killian. i'll give it a bash - looks promising, maybe i can keep a bookmark in the template somwhere as a place holder for something - right useful those bookmarks. I'm only just starting to wrap my head around them.
    Nothing annoys a non-conformist more than other non-conformists who refuse to conform to the rules of non-conformity.


    Confused is my normal state of mind


  4. #4
    VBAX Regular
    Joined
    Aug 2004
    Location
    On a 100 acre hobby farm in beautiful west Quebec.
    Posts
    87
    Location
    Whatever approach you use, don't forget to turn off widow/orphan control in the paragraph formatting. When on, Word will try to avoid exactly what you want: the last line of a paragraph (a widow line) shuld not normally be allowed to be by itself at the top of a page. (The orphan line is the opposite: a first line of a paragraph should not normally be allowed to be by itself at the bottom of a page.) Both are typesetting conventions.
    Eric

    Experience is not what happens to a man; it is what a man does with what happens to him. ? Aldous Huxley

  5. #5
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    OK, this COULD be done, but I do not see how you can do it without inserting a page break into the previous paragraph. As in:

    araOneJUNKParaOneJUNKParaOneJUNKParaOneJUNK
    ParaOneJUNKParaOneJUNKParaOneJUNKParaOneJUNK

    ParaTwoJUNKParaTwoJUNKParaTwoJUNKParaTwoJUNK
    ParaTwoJUNKParaTwoJUNKParaTwoJUNKParaTwoJUNK

    then becomes

    page one
    ----------------------------------------------------------
    ParaOneJUNKParaOneJUNKParaOneJUNKParaOneJUNK
    PageBreak!!!!
    page two
    ----------------------------------------------------------
    ParaOneJUNKParaOneJUNKParaOneJUNKParaOneJUNK

    ParaTwoJUNKParaTwoJUNKParaTwoJUNKParaTwoJUNK
    ParaTwoJUNKParaTwoJUNKParaTwoJUNKParaTwoJUNK

    This can be done. A little weird, but possible. The problem is....you now have a page break. The consequences may not be what you want. What if more text is place into page one? It would push a bit into a next page, but the PageBreak would remain, and you would have a gap.

    Could you explain the requirement for doing this?

Posting Permissions

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