Problem with Find and Tables

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I've made a script that search all words of a specified style.
This macro works fine but enter in an infinite loop when it find a text
with the specified style into a table

Any idea ?

Here is the script :
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set appWord = Wscript.CreateObject("Word.Application")
appWord.Documents.Open("C:\users\erik\bnpp\search.doc")
appWord.Visible = False
appWord.Selection.Find.ClearFormatting
With appWord.Selection.Find
.Text= ""
.Style = appWord.ActiveDocument.Styles("Exigence")
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
Do While appWord.Selection.Find.Execute = True
MsgBox appWord.Selection
Loop
End With
appWord.Quit
Set appWord = Nothing
.



Relevant Pages

  • Re: Is inifinite loop not a good practice?
    ... I have to write a python script that would continously monitor and process a queue database. ... Once the script sees an unprocessed record it will create a thread to process it otherwise it will do nothing. ... I've been planning to do an infinite loop within the script to do this but I've been hearing comments that infinite loop is a bad programming practice. ...
    (comp.lang.python)
  • Re: Stop PHP utterly!
    ... > I made a typo and got caught in an infinite loop. ... > the execution time expires and fix the script but this time it kept going ... > I finally just rebooted the server! ...
    (alt.php)
  • Re: Stop PHP utterly!
    ... > I made a typo and got caught in an infinite loop. ... > the execution time expires and fix the script but this time it kept going ... > I finally just rebooted the server! ...
    (comp.lang.php)
  • Re: While read and "too many open files" problem.
    ... : On 7 Mar, 12:37, Bruce Barnett ... :> You have a potentially infinite loop reading the same file over and over ... script is continually scanning the log file for new entries. ...
    (comp.unix.shell)