Results 1 to 5 of 5

Thread: [RESOLVED] loop between two bookmarks, or test EOF???

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2006
    Posts
    34

    Resolved [RESOLVED] loop between two bookmarks, or test EOF???

    Hi
    I needed to test for end of document equivalently to loop a section, better said between two bookmarks. Let's say from bookmark A to bookmark B, I want to iterate something, so I tried the following, on a document with a few lines:
    VB Code:
    1. Sub test()
    2. counter = 0              
    3. Do Until (ActiveDocument.Bookmarks("\Sel") = ActiveDocument.Bookmarks("\EndOfDoc"))
    4.     Selection.EndKey unit:=wdLine, Extend:=wdExtend
    5.     Selection.MoveDown unit:=wdLine, Count:=2
    6.     counter = counter + 1
    7.     MsgBox counter
    8. Loop  
    9. End Sub

    The problem with it is that it is an infinit loop, but I don't see why it isn't working as desired!!?? has someone an idea, please?
    Last edited by Hack; May 4th, 2006 at 06:58 AM. Reason: Added [RESOLVED] to thread title

Posting Permissions

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



Click Here to Expand Forum to Full Width