Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Apr 2001
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Determining if your on the first paragraph in page (VBA Word 2000)

    I need two things that ought to be simple, but are driving me crazy trying to figure out.

    1. I need to determine if I am on the first paragraph on a page.

    2. I need to move to the first paragraph on a page if I'm not there.

    Please help!!
    Thanks!!
    Troy

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Determining if your on the first paragraph in page (VBA Word 2000)

    Moving to the first paragraph of the page is fairly easy.
    <pre>ActiveDocument.Bookmarks("Page").Range.Paragr aphs(1).Range.Select
    </pre>

    Maybe someone can come up with a simpler solution to check whether the selection is currently in the first paragraph of a page
    <pre>if selection.Start >= ActiveDocument.Bookmarks("Page").Range.Paragraphs( 1).Range.Start _
    and Selection.End <=ActiveDocument.Bookmarks("Page").Range.Paragraph s(1).Range.End _
    then
    ' Do something here
    End If
    </pre>

    StuartR

  3. #3
    4 Star Lounger
    Join Date
    Apr 2001
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Determining if your on the first paragraph in page (VBA Word 2000)

    If I understood your statement correctly, what you had there would only be true if there was only one paragraph on the page.

    So I ended up with:

    If Selection.Start > ActiveDocument.Bookmarks("Page").Range.Paragraphs( 1).Range.Start Then
    ActiveDocument.Bookmarks("Page").Range.Paragraphs( 1).Range.Select
    End If

    Thanks for the help!!
    Troy

Posting Permissions

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