stop at end 
Author Message
 stop at end

Hello all,

I want this marco to loop the whole document, from
beginning to end, than stop at the end. I can't figure out
how to stop the loop.

Thank for any help. ray

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "^p^p"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    Selection.HomeKey Unit:=wdLine
    Selection.MoveDown Unit:=wdLine, Count:=1
    Selection.Delete Unit:=wdCharacter, Count:=1



Sat, 05 Mar 2005 10:30:33 GMT  
 stop at end
Hi Ray,

You really don't want to loop for this because that would take much too
long. Instead, just use the find/replace:

With Selection
    .HomeKey Unit:=wdStory
    With .Find
        .ClearFormatting
        .Text = "^p^p"
        .Replacement.Text = "^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        .Execute Replace:=wdReplaceAll
    End With
End With

HTH

Quote:
> Hello all,

> I want this marco to loop the whole document, from
> beginning to end, than stop at the end. I can't figure out
> how to stop the loop.

> Thank for any help. ray

> Selection.HomeKey Unit:=wdStory
> Selection.Find.ClearFormatting
>     With Selection.Find
>         .Text = "^p^p"
>         .Replacement.Text = ""
>         .Forward = True
>         .Wrap = wdFindContinue
>         .Format = False
>         .MatchCase = False
>         .MatchWholeWord = False
>         .MatchWildcards = False
>         .MatchSoundsLike = False
>         .MatchAllWordForms = False
>     End With
>     Selection.Find.Execute
>     Selection.HomeKey Unit:=wdLine
>     Selection.MoveDown Unit:=wdLine, Count:=1
>     Selection.Delete Unit:=wdCharacter, Count:=1



Sat, 05 Mar 2005 20:13:58 GMT  
 stop at end

Ray,

You need a Do-loop inside the Find, with your text-editing lines inside it:

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "^p^p"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        Do While .Execute
            Selection.HomeKey Unit:=wdLine
            Selection.MoveDown Unit:=wdLine, Count:=1
            Selection.Delete Unit:=wdCharacter, Count:=1
        End With
    End With

--

Reply ONLY to the newsgroup.  Note: MVPs do not work for Microsoft.
MVP FAQ: http://www.mvps.org/word
Userform demystification: http://www.speakeasy.org/~mtangard/userforms.html
"Life is nothing if you're not obsessed." --John Waters

Quote:

> Hello all,

> I want this marco to loop the whole document, from
> beginning to end, than stop at the end. I can't figure out
> how to stop the loop.

> Thank for any help. ray

> Selection.HomeKey Unit:=wdStory
> Selection.Find.ClearFormatting
>     With Selection.Find
>         .Text = "^p^p"
>         .Replacement.Text = ""
>         .Forward = True
>         .Wrap = wdFindContinue
>         .Format = False
>         .MatchCase = False
>         .MatchWholeWord = False
>         .MatchWildcards = False
>         .MatchSoundsLike = False
>         .MatchAllWordForms = False
>     End With
>     Selection.Find.Execute
>     Selection.HomeKey Unit:=wdLine
>     Selection.MoveDown Unit:=wdLine, Count:=1
>     Selection.Delete Unit:=wdCharacter, Count:=1



Sun, 06 Mar 2005 02:02:01 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Loop search, do something, stop at end

2. DotMatrix Print Won't Stop At End of Page

3. End of record stop.

4. can't kill or end or stop my application

5. How to stop a sub command with out ending application

6. TaskList - Stop End Task

7. Compile Error: End if without block end if

8. A2k: Controlling a back-end MDB from its FRONT-end MDB

9. A2K Updating Back End with new fields from Front End

10. Compact the back-end data from the front-end

11. Corrupted back end corrputs all front ends!

12. Splitting db in front end and back end

 

 
Powered by phpBB® Forum Software