How to jump out of this circle? 
Author Message
 How to jump out of this circle?

How to jump out of this circle?

In this program, when all the "abc" is deleted, the
program is hung, please show me how to jump out.

Sub delabc()
Do
With Selection.Find
    .Text = "abc"
    .Format = False
    .Wrap = wdFindStop
    If .Execute Then
        Selection.Paragraphs(1).Range.Delete
    End If
End With
  Loop      
End Sub



Tue, 12 Jul 2005 09:14:15 GMT  
 How to jump out of this circle?
Change this line

    Loop

to this

    Loop While Selection.Find.Found

You could put the Do-Loop inside the With block, in which case the loop
statement becomes just Loop While .Found

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
Word FAQs at http://www.multilinker.com/wordfaq
Please post any follow-up in the newsgroup. I do not reply to Word questions
by email


Quote:
> How to jump out of this circle?

> In this program, when all the "abc" is deleted, the
> program is hung, please show me how to jump out.

> Sub delabc()
> Do
> With Selection.Find
>     .Text = "abc"
>     .Format = False
>     .Wrap = wdFindStop
>     If .Execute Then
>         Selection.Paragraphs(1).Range.Delete
>     End If
> End With
>   Loop
> End Sub



Tue, 12 Jul 2005 09:18:55 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. university EMR send outs

2. on the outs

3. Learning the ins and outs of Peek and Poke

4. How to handle print outs in VB?

5. Filesystem Time outs

6. Session Variable Time-outs

7. Time-outs

8. Need help with time outs

9. Can I draw a circle?

10. Circle?

11. Queryresult to diagram/circles

12. Create line or circle on user Forms

 

 
Powered by phpBB® Forum Software