dcsimg
Results 1 to 6 of 6

Thread: Find End of the Page

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    243

    Find End of the Page

    Hi, I'm creating word doc from my vb6 application. I writes some data on each page.
    After desired contents on the page i use pagebreak so that it will go to second page.
    here what i need that when i use Insertbreak command then before that i have to write something
    on the end line of page. so the question is how to find last line of that page and write on that line and
    then send Insertbreak command.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,383

    Re: Find End of the Page

    goto next page, move back 1 character, but this will take you to end of text on page, not bottom of page, better to put in footer if possible, but then same for all pages, except field values

    if you need to write at the bottom of page, without using footers, either you will have to fill page with empty paragraphs to bottom line, or insert a textbox or frame in the correct position
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    243

    Re: Find End of the Page

    Means I always have to count the lines. sometimes data comes from database. so we don't know how much
    lines it will consume and we never come to know whether we are on next page or on current.
    I think the best way is to put it in footer or try to insert a textbox or frame as you suggested.
    Can u post some code to put in textbox or frame or how to insert value in footer.
    thanx for your reply.

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,383

    Re: Find End of the Page

    Can u post some code to put in textbox or frame or how to insert value in footer.
    did you try recording a macro?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    243

    Re: Find End of the Page

    No I haven't. Can u post some example to put something on the last line of page using macro.?

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,383

    Re: Find End of the Page

    this will put a textbox with some text at the bottom of the current page
    Code:
    Set tb = ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 40, (ActiveDocument.PageSetup.PageHeight - 150), 350, 50)
    tb.TextFrame.TextRange.Text = "this is a test 23"
    change positions etc to suit

    you can use the selection object to go to next page or a specific page, like
    Code:
    Selection.GoTo wdGoToPage, wdGoToNext
    working with textbox shapes in word is not specially easy
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width