Results 1 to 11 of 11
  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    End of page - Continue (Word 2000)

    Is it possible to force a page break or recognise the end of the page.
    My documents which in some cases should be 2 pages end up as 3.

    I get page 1 fine, page 2 consists of only a few entries and page3 is mostly Ok.
    It just looks so unprofessional when Emailing or printing.
    I usually unprotect the doc and edit the format manually.

    Here's the code I'm using to process the text document onto the .Doc template>:

    <pre>Public Sub ProcessWordDoc(strFile As String, JN As String, strType As String)
    Dim oWord As Object
    Dim oDoc As Object
    frmWait.Show
    ' Start Word
    Set oWord = CreateObject("Word.Application")

    ' Create document based on template
    Set oDoc = oWord.Documents.Add("C:MM-UtilitiesLongtonHeader.dot")
    ' Import report
    oWord.Selection.InsertFile strFile, , False
    ' Process document
    oWord.Selection.HomeKey 6
    ' Delete initial returns
    Do While Asc(oWord.Selection) < 32
    oWord.Selection.Delete 1
    Loop
    With oWord.Selection.Find
    .Execute "^p^p^p^p^p^wINVOICE", , , , , , , 1, , _
    "^m INVOICE", 2
    .Execute "^p^p^p^p^p^wESTIMATE", , , , , , , 1, , _
    "^m ESTIMATE", 2
    .Execute Chr(26), , , , , , , 1, , "", 2
    Do While .Execute(Chr(27), , , , , , , 1) = True
    oWord.Selection.HomeKey , 1
    oWord.Selection.EndKey , 1
    oWord.Selection.Delete
    Loop
    .Execute "^w^p", , , , , , , 1, , "^p", 2
    Do While .Execute("^p^p^p", , , , , , , 1, , "^p", 2) = True
    Loop
    .Execute "
    Attached Images Attached Images

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: End of page - Continue (Word 2000)

    Hi Dave,

    I'm not entirely clear on what you want. What should have happened with the two lines in the second page of your screenshot?

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: End of page - Continue (Word 2000)

    Hans

    They are just continued text.
    Attached Files Attached Files

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: End of page - Continue (Word 2000)

    OK, but what would you like to do with them?

  5. #5
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: End of page - Continue (Word 2000)

    Hans

    I've removed all the space from page 2 and also removed the text at the top of page 3 to give me a document which now looks correct.

    See the attached which is now 2 pages instead of 3.
    Attached Files Attached Files

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: End of page - Continue (Word 2000)

    Dave, we'd have to know what the original file looks like to investigate how the code behaves.

  7. #7
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: End of page - Continue (Word 2000)

    Hans

    Attached is the original which is processed by the code.
    I've removed ant sensitive info with zero's
    Attached Files Attached Files

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: End of page - Continue (Word 2000)

    The problem is that the header/footer take up more space than in the version we discussed a long time ago, so two lines that originally fit on the 1st page now spill to a 2nd page. Would it be acceptable to use a smaller font? If I insert the bolded line below, the text fits again:

    ...
    End With

    oDoc.Content.Font.Size = 9
    ' Save and close the document
    ...

  9. #9
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: End of page - Continue (Word 2000)

    Hans

    That works fine, can the margin be alterred with code to centralise everything ?

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: End of page - Continue (Word 2000)

    It could be done in code, but you might as well set the margin in the template - you need to do it only once. A left margin of 1.25" seems to be about right.

  11. #11
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: End of page - Continue (Word 2000)

    Ok Hans

    All sorted, thanks for all your help once again.

Posting Permissions

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