
Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Jean-Guy,
Thank you for your feed back.
I guess that I will have to do that.
I have a long report. At the end of each section in the report, there is a summary on that section. Sometimes that summary can
spill over onto the next page.
I was trying to search for the string for the start of the first summary so I can find the starting position of the first summary.
Then I was searching for the next page break: the end of that summary. After I select the summary and cut it out, I now need to
search for a 2nd page of the same summary. I was doing this by using a Do While loop:
Selection.Find.Text = pstrSearchStrings(pintIndex)
Do While Selection.Find.Execute
well, within my Do While loop, I need to switch the text to look for the page break:
Selection.Find.Execute "^m"
now, if I don't switch my Find.Text back to the original setting, the Do While loop will not work correctly:
Selection.Find.Text = pstrSearchStrings(pintIndex)
Do While Selection.Find.Execute
...
Selection.Find.Execute "^m"
...
...
Selection.Find.Text = pstrSearchStrings(pintIndex)
Loop
I was hoping that it was possible to create 2 different Find Object variables and set the Find.Text for each of those variables to
somthing different. Something like:
Dim pfndPageBreak as New Find
Dim pfndSummaryText as New Find
pfndPageBreak.Text = "^m"
pfndSummaryText.Text = pstrSearchStrings(pintIndex)
and then my Do While would look something like this:
Do While pfndSummaryText.Execute
...
pfndPageBreak.Execute
...
...
'Selection.Find.Text = pstrSearchStrings(pintIndex) '<-- This line would not be needed anymore
Loop
But that doesn't work. As soon as I switch to look for a page break, it changes my Find.Text in the whole application and if I
don't reset my Find.Text back to it's original setting, the Do While loop won't work correctly.
Thanks again for all of your help,
Conan Kelly
> Conan Kelly was telling us:
> Conan Kelly nous racontait que :
[quoted text clipped - 13 lines]
>
> You could have a parameterized Function that accept the "text" as a parameter and return the result.
Jean-Guy Marcil - 14 Nov 2006 02:22 GMT
Conan Kelly was telling us:
Conan Kelly nous racontait que :
> Jean-Guy,
>
[quoted text clipped - 16 lines]
> well, within my Do While loop, I need to switch the text to look for
> the page break:
You could try something like this instead:
Dim strSummary As String
strSummary = "Summary"
Selection.HomeKey wdStory
With Selection.Find
.Text = strSummary
Do While .Execute
With Selection
.MoveEndUntil Chr(12), wdForward
.MoveRight wdCharacter, 1, wdExtend
.Delete
End With
Loop
End With

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org