Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Feb 2001
    Location
    Jackson, Mississippi, USA
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Word locks after using extend mode & find dialog (Word 2000 SR-1)

    On the attached sample document, the user is using the F8 Cntrl+F combination to select text for deletion. For example, say the cursor is at the beginning of the paragraph for "SECTION 2", press F8 and Cntrl+F and type in SECTION 4. Cancel or close the find dialog and back the selection up to the end of the previous line and delete. The document now contains SECTION 1 and SECTIONS 4 through 20.

    I have a macro that runs through the document and renumbers the sections. One of the first things that happens is that I do a search and replace for five spaces before the word SECTION and replace it with a tab, so that my renumbering routine won't miss if the user has used spaces instead of a tab.

    If the user deletes text using the shift and arrow keys, no problem. If they use the F8 or extend mode in combination with the find dialog, Word locks up.

    I've isolated the lockup to the execute on the docrange.find and pasted in relevant code.

    Can anyone duplicate this behavior?

    Thanks!
    Ann Brandon

    Sub WhatTheHeck()
    Set docrange = ActiveDocument.Content

    'see if there is any SECTION preceded by 5 spaces and replace with tab
    With docrange.Find
    .Execute " SECTION ",false,false,false,false,false,True, wdFindContinue, False, "^tSECTION ", wdReplaceAll, false, false, false,false
    End With
    'comment expression.Execute(FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike, MatchAllWordForms, Forward, Wrap, Format, ReplaceWith, Replace, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl

    End Sub
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Word locks after using extend mode & find dialog (Word 2000 SR-1)

    FWIW, I can reproduce the problem in Word 97 SR2 (after removing the last four arguments to Find.Execute - they are new to Word 2000). No idea about the cause, or about a solution, I'm afraid.
    The Windows NT Task Manager doesn't report Word as "Not responding", but as "Running" and taking up 99% of processor time.

  3. #3
    New Lounger
    Join Date
    Feb 2001
    Location
    Jackson, Mississippi, USA
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word locks after using extend mode & find dialog (Word 2000 SR-1)

    Thanks, Hans for taking the time to try this out. Our Windows task manager does say 'not responding', and the processor time is also 99%.

    Ann Brandon

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Word locks after using extend mode & find dialog (Word 2000 SR-1)

    Wow, this is a bad one. I'm running Word 2000 SR-1 with SP-2 applied, and get freezes or, alternately, Word closes with an error dialog. I found that if the document was in Normal view, the find would run, but when trying to switch it back to Print Layout, Word would lock up. Changes to the Continuation parameter, using StoryRanges(wdMainStory), and various other experiments were unsuccessful. Very odd.

    It's a hassle for the user when you change the Find dialog settings, but this workaround using the Selection object does "solve" the problem:
    <pre>Sub test()
    ActiveDocument.Bookmarks.Add Name:="tmpPlaceMarker", Range:=Selection.Range
    ActiveDocument.Content.Select
    Selection.Find.Execute " SECTION ", False, False, False, _
    False, False, True, wdFindContinue, False, "^tSECTION ", wdReplaceAll, _
    False, False, False, False
    Selection.GoTo What:=wdGoToBookmark, Name:="tmpPlaceMarker"
    ActiveDocument.Bookmarks("tmpPlaceMarker").Delete
    End Sub</pre>

    Hope this helps.

  5. #5
    New Lounger
    Join Date
    Feb 2001
    Location
    Jackson, Mississippi, USA
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word locks after using extend mode & find dialog (Word 2000 SR-1)

    Thanks for the work-around. These particular documents are always in Print Layout view, but you're right, switching it to Normal view did make a difference. I appreciate your time and help!
    Regards,
    Ann Brandon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •