none
Find Words between caret symbols RRS feed

  • Question

  • I am seeing a difference between using word's find facility and the one I have coded.

    What I am trying to do is evaluate word(s) enclosed in the ^ character.  When I use the find toolbar in Word it will evaluate the word(s) between the first ^ and the second ^, then the second ^ and the third ^ and then the third ^ and fourth ^ and so on....   The code I am using evaluates the word(s) between the first ^ and the Second ^, then the third ^ and the fourth ^.   I am looking to have the same results as the find function in word.

    Here is the code that I am using.

    for each lorange in odocument.storyranges
      with lorange.find
        .clearformatting
        .text = "^^*^^"
        .forward = .t.
        .format = .f.
        .matchwildcards = .t.
        .matchcase = .f.
        .matchwholeword = .f.
        .matchallwordforms = .f.
        .matchsoundslike = .f.
      endwith
      do while lorange.find.execute
        if lorange.find.found = .t.
          wait window lorange.text && Look at what is found
        endif
      enddo
    endfor

    Any suggestions would be greatly appreciated!

    Stuart


    • Edited by Stuman99 Friday, June 1, 2012 6:36 PM typo
    Friday, June 1, 2012 6:35 PM

Answers

  • Try

    for each lorange in odocument.storyranges
      with lorange.find
        .clearformatting
        .text = "^^*^^"
        .forward = .t.
        .format = .f.
        .matchwildcards = .t.
        .matchcase = .f.
        .matchwholeword = .f.
        .matchallwordforms = .f.
        .matchsoundslike = .f.
        do while .execute
          wait window lorange.text && Look at what is found
          lorange.collapse
          lorange.movestart
        enddo
      endwith
    endfor


    Regards, Hans Vogelaar

    • Marked as answer by Stuman99 Friday, June 1, 2012 9:29 PM
    Friday, June 1, 2012 7:43 PM